How to package a Windows Runtime component for distribution? - windows-runtime

I have built a WinRT component (.winmd) for use by both JavaScript and XAML Windows Store apps. When including and referencing the loose .winmd file output in a JavaScript client, I see this build warning:
Microsoft.AppXPackage.Targets(808,9): warning APPX1707: No implementation file was provided for the .winmd file 'myRuntimeComponent.winmd'. To generate registration information in the app manifest, specify the 'Implementation' metadata on the .winmd reference item in the project file.
I can't find any documentation on this error or how to include implementation metadata.
When running the JavaScript client, this exception is thrown when a class method exported from the .winmd is called:
0x80040154 - JavaScript runtime error: Class not registered
Note that I am referencing the loose .winmd file in the client application project, rather than referencing the Visual Studio project that builds the .winmd. My use case is distributing the .winmd output, not the full source for the .winmd component - source distribution is not an option.
Also note that when the Windows Runtime component is referenced as a project reference, the JavaScript client builds and runs correctly. The C# XAML client runs correctly with either a project reference or a reference to the loose .winmd.
It seems as if some registration information is not being generated in the client application build when a loose .winmd is referenced.
How can I build and distribute a loose Windows Runtime component for use by both JavaScript and managed clients?

A WinRT component built with C# or VB produces a .winmd that contains both metadata and implementation. A component built with C++ provides separate .winmd and .dll files, and the DLL is what contains the details to register the component.
Apparently, as the warning indicates, you need to edit the project file with something like the following to point to the DLL:
<Reference Include="component">
<HintPath>component.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Implementation>component.dll</Implementation>
</Reference>

Alternatively you might want to look into Extension SDKs. See the below link for how to package your component as an easy to consume Extension SDK in VS:
http://msdn.microsoft.com/en-us/library/jj127119.aspx

Related

How load custom .net dll with accoreconsole.exe in Design Automation with all AutoCAD DLL's

I have created a AutoCAD custom .net dll for the desktop version which had some operation.
Adding multiple empty drawing documents.
Opening the existing drawing document and copying the required blocks in the newly created drawing document.
Performing some operation on them, discarding all the unnecessary drawing documents and saving one of them as an output drawing document.
I had a query regarding opening the existing document and adding the empty document using Design Automation API but I couldn't achieve it with Design Automation.
As I explored I found that only AcCoreMgd.dll and AcDbMgd.dl are allowed with accoreconsole.exe.
Load custom .net dll inside accoreconsole.exe
DLL's used by AutoCAD custom .net project for desktop version are (AcCoreMgd.dll,AcCui.dll,AcDbMgd.dll,AcMgd.dll,AcTcMgd.dll,AdUIMgd.dll)
I wanted to use all the above DLL's with Design Automation for AutoCAD.
Will you please let us know how we can use desktop versions like support in Design Automation for AutoCAD?
It is not possible to add other modules when working with Design Automation or AccCoreConsole. Please note AcCoreConsole is a Headless part of AutoCAD in other words no UI libraries are permitted. Following are the libaries that a crx app should bind.
Where XX - module version of AutoCAD release for more details
If you are developing a .NET module, you need to use following Nuget
ac1stXX.lib
acdbXX.lib
acdbmgd.lib
AcDbPointCloudObj.lib
acgeXX.lib
acgiapi.lib
acismobjXX.lib
AcMPolygonObjXX.lib
AcSceneOE.lib
axdb.lib
rxapi.lib
acbrXX.lib
acgexXX.lib
AdImaging.lib
AdIntImgServices.lib
AecModeler.lib
AsdkHlrApiXX.lib
acapp_crx.lib
AcCamera.lib
accore.lib
AcFdEval.lib
AcPublish_crx.lib
Why do you need to open mutilple documents ?, you can insert multiple blocks from different drawings in to Host drawing. Make modifications, save and send to your Server.

Error accessing WinRT sensors in C++ desktop application

I am trying to access the WinRT sensors from a Win32 desktop application using C++/CX as mentioned here: https://software.intel.com/en-us/articles/using-winrt-apis-from-desktop-applications
When I include the C++/CX header file it causes an error when building the Win32 project.
Exact error text: "error C1190: managed targeted code requires a '/clr' option."
Since I am not using /clr code at all, this is a confusing error.
Any suggestions? Please educate me if there is a better way to do this.
The error you are getting is because you are compiling some files without /ZW option for compiler. Since you are able compile at least some files with WinRT extensions, but not others, your project configuration is inconsistent.
The option /ZW (enable WinRT extensions) has to be configured on the level of project (and not on the level of individual files). There are two ways to ensure your settings are consistent. First method is through UI in Visual Studio -- you have to go through all platforms/configurations on the project and ensure /ZW is enabled, then got through all indivudual .cpp files, and ensure they don't override project level settings. This is tedious and error prone. The easier method is to open .vcxproj in notepad and do the following:
Add this section at the beginnig of the file, under root Project node:
<ItemDefinitionGroup>
<ClCompile>
<CompileAsWinRT>true</CompileAsWinRT>
</ClCompile>
</ItemDefinitionGroup>
Search and remove any other places where <CompileAsWinRT> is defined.

Calling a C# method from C++ in Windows Phone 8 (for real)

I'm using a game engine which generates a native C++ project (DirectX) for a Windows Phone 8 app. To integrate such things as in-app-billing however I need to call a C# method everytime a specific C++ method is triggered in the engine. There is a SO-thread named calling a C# method from C++ in WP8 which apparently is just the other way around: "a C# based app actually calling a C++ method".
Where I'm stuck right now is that I created a "Visual C++ -> Windows Phone Runtime Component" with a C++/CX public ref class sealed using Visual Studio 2012 Express for Windows Phone. This references a .winmd file of a "Visual C# -> Windows Store Class Library" that has the project properties set to "Windows Runtime Component". Interestingly I had to create this in Visual Studio 2012 Express for Windows 8 (NOT Windows Phone), because VS for WP8 doesnt provide an option for generating a .winmd file. Compiling my game I get the following error message:
No implementation file was provided for the .winmd file '...\InAppBilling.winmd'. To enable generation of registration information in the app manifest, specify the 'Implementation' metadata on the winmd reference item in the project file.
How do I call a C# method from within C++? I don't need any fancy stuff like DLLs, inheritance, delegates etc. Just a plain static call that works, everything else will be handled in C# anyway.
This is only possible if you create a XAML and Direct3D app. In that case you can call from C++ to C# using the Windows Runtime method in the other SO question.
As it is not possible to create a C# Windows Runtime component on the phone (unlike for a Windows Store app), it isn't possible to call a C# method from a native C++ project.

MvxTrace output in WPF project

I'm not seeing any MvxTrace output in my WPF project. I'm using the default project template created by NuGet.
Is there anything special that must be done or is this a bug?
The default WPF project provides debug output via MvxDebugTrace
For Release assemblies (such as those included in Nuget) this obviously does nothing.
If you want to link to the release assemblies but use Debug output, then you can do so by implementing IMvxTrace and by providing your implementation during setup - you'll need to override protected abstract IMvxTrace CreateDebugTrace(); - in https://github.com/slodge/MvvmCross/blob/v3/Cirrious/Cirrious.MvvmCross/Platform/MvxSetup.cs#L25

Found conflicts between different versions of the same dependent assembly.MVC3 -> MVC4 / EF4 -> EF5

The question is how to resolve conflicts between versions of assemblies in my project that was upgraded to MVC4 and EF5?
The problem is manifest in the fact that my controllers and models can include System.Data.Objects, but now my views.
I am using MVC 4, my project was upgraded from MVC 3.
Entity Framework is version 5.
I have a controller that is able to use objectcontext from System.Data.Objects.
My Usings:
using System.Data.Objects;
using System.Data.Entity;
When I try to include the using in the view form System.Data.Objects, I get :
CS0234: The type or namespace name 'Objects' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
I am targeting .net 4.5
My Build Displays this message:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1561,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.
You can build your solution in diagnostic mode to get more detailed information about the error.
Open the VS Options dialog (Tools > Options), navigate to the "Projects and Solutions" node and select "Build and Run". Change the MS Build project build output verbosity to Diagnostic.
Have a look here.
If you look at the build message, it states the 4.0 version of the .net framework is referenced... Is there a setting in your project file or web/app.config specifying a conflicting version of the .net framework?
Are you familiar with fuslog? you can set it up to log all assembly bindings that .net is doing while running your application. You should then be able to see detailed information on what is getting bound when. If you still can't figure it out, you can always do a binding redirect on that .dll in the web.config.
http://msdn.microsoft.com/en-us/library/eftw1fys.aspx -- binding redirects
http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.71).aspx -- fusion log viewer
Set up fusion logger and take a look at what the output is. If you don't get an answer from that, try the binding redirect (which would give you at least a temporary solution).
In the directory I was publishing to, there was a folder named aspnet_client. I moved it (instead of deleting it), republished, and it worked. I'm not sure why that folder decided to give me trouble out of the blue.