- Create new Windows 8 application
App1
- Add
ClassLibrary1
Windows 8 class library project to solution - Add
PortableClassLibrary1
portable class library targeting Windows 8 and Windows Phone 7.5 to a solution - Reference
HttpClient
nuget package inClassLibrary1
- Reference
HttpClient
nuget package inPortableClassLibrary1
- Reference both
ClassLibrary1
andPortableClassLibrary1
- Compile solution
You get an error at .appx package stage
Payload contains two or more files with the same destination path 'System.Net.Http.Primitives.dll'.
Source files:
\Projects\App1\PortableClassLibrary1\bin\Debug\System.Net.Http.Primitives.dll
\Projects\App1\packages\Microsoft.Net.Http.2.2.13\lib\win8\System.Net.Http.Primitives.dll
Please note the same error is reproduced if you reference any nuget package featuring both win8 and portable blends of assemblies.
What is expected: Most specific version of a library (win8 one) is packaged into .appx and portable version is ignored
Any ideas on how to cheat appx packager and build this kind of Windows 8 projects?
In addition to this, you should be getting warnings similar to:
This is indicating a problem. Basically, the short of it, you should be installing HttpClient.Compression into all projects. MSBuild/AppX packaging doesn't know which binary to deploy between the portable library and store library project (they have different APIs & versions). Installing the package into the application, tells it.