简体   繁体   中英

Cannot Build Visual Studio Installer Project when main project has any .winmd references

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?

您也可以尝试将引用属性设置为CopyLocal = false

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.

解决方案是将生成文件(.exe和.dll)复制/粘贴到部署项目的文件系统中,而不是让部署项目生成项目输出。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM