Cannot Build Visual Studio Installer Project when

2019-08-23 17:24发布

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?

3条回答
一纸荒年 Trace。
2楼-- · 2019-08-23 17:36

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.

查看更多
欢心
3楼-- · 2019-08-23 17:45

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.

查看更多
太酷不给撩
4楼-- · 2019-08-23 17:51

you can also try to set the reference property to CopyLocal=false

查看更多
登录 后发表回答