Nov 11, 2012 at 9:23 PM
Edited Nov 11, 2012 at 9:30 PM
be postponed for a future release until the issues below can be resolved in a better way before creating confusion and causing frustration among the users.
I also wanted to preface this by saying that I've been actively developing a mixed WinJS/C# application, so the following is based on a real project.
The issue is that if a WinMD file references other assemblies, then things get confusing real fast. In order for the packaging to work correctly, the referenced dll's need to be in the same directory as the winmd file. WinJS cannot directly reference the
dll files, but the WinMD file can. When things are packed, up, it'll correctly include the files alongside the winmd file.
Making things complicated, if the same dll is in two different directories, then AppX packaging gets confused and errors out:
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\AppxPackage\Microsoft.AppXPackage.Targets(374,9): error APPX1101: Payload contains two or more files with the same destination path 'TimeZones.dll'. Source files:
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\AppxPackage\Microsoft.AppXPackage.Targets(374,9): error APPX1101: C:\Users\Oren\Documents\Visual Studio 2012\Projects\SampleApps\packages\WinRTTimeZones.0.7.2\WinRT\TimeZones.dll
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\AppxPackage\Microsoft.AppXPackage.Targets(374,9): error APPX1101: C:\Users\Oren\Documents\Visual Studio 2012\Projects\SampleApps\packages\WinRTTimeZones.0.7.2\lib\netcore45\TimeZones.dll
Here's the scenario:
DataAccess - WindowsRuntime component (netcore45)
CoreLogic - PCL(net45/netcore45)
DataAccess references CoreLogic. WinJSApp references DataAccess, as it's the only WinRT library.
You can see the repro in
That alone isn't the entire issue. What happens if the WinMD file needs references that reside in a different package? There's currently no way to resolve this as the reference cannot be added to the WinJS project -- it has to be alongside the winmd file.
This also doesn't take C++ WinMD files into account where there are platform-specific versions (x86/x64/ARM).
The better/correct way to deal with WinJS references (and Windows Runtime in general) is to fully support ExtensionSDKs as per Garrett's spec
here and the comments in this thread: http://nuget.codeplex.com/discussions/396720. Unfortutely, I believe Garrett has been called onto other things
and isn't currently able to work on the feature.
The reason Extension SDK's solve this problem is that they have the concept of both a redist and references directory. In the above example, the WinMD file would be in the references dir and the supporting DLLs would be in the redist folder. They also support
the notion of dependencies -- so one Extension SDK can depend on another one. The contents of any required dependencies would be in that pacakges redist dir, so they'd all get copied to the output dir without needing to be directly referenced (Only the ExtensionSDK
itself would be referenced and it'd all work). Extension SDK's also handle release/debug and platforms.