I'm following the steps in this article.
My solution has a console app project and a visual studio installer project.
In the console app project, if I add any of the following references, I can no longer build my installer project.
For example, in the add references dialog, I go to browse, and select
C:\Program Files (x86)\Windows Kits\10\References\10.0.15063.0\Windows.Foundation.UniversalApiContract\4.0.0.0\Windows.Foundation.UniversalApiContract.winmd
This reference will prevent my deployment project from building. The error message is:
ERROR: An error occurred while validating. HRESULT = '80070057'
Similarly, all of these references will break the deployment project build.
Windows.Foundation.FoundationContract.winmd
Windows.winmd
Windows.Foundation.UniversalApiContract.winmd
Windows.Foundation.FoundationContract.winmd
My question is, how do I reference these UWP APIs without breaking my installer project?
The solution was to copy/paste the build files (.exe and .dll) into the deployment project's file system, instead of having the deployment project build the project output.
I have come across the same problem when using the new Microsoft Installer Projects for VS2017 (Enterprise).
I echo Mike's solution - add the project output files into the project manually. If you reference the "/bin/Release" project binaries then it will always incorporate the most up-to-date copy anyway (providing you build the projects before the installer). Turns out you don't need a copy of the .winmd in the application directory for it to run correctly.
You can produce the GUI version of the 80070057 error by trying to add a .winmd file by hand to any installer project.
you can also try to set the reference property to CopyLocal=false