[英]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. 我的解决方案有一个控制台应用程序项目和一个Visual Studio安装程序项目。
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? 我的问题是,如何在不破坏安装程序项目的情况下引用这些UWP API?
您也可以尝试将引用属性设置为CopyLocal = false
I have come across the same problem when using the new Microsoft Installer Projects for VS2017 (Enterprise). 使用针对VS2017的新Microsoft安装程序项目(企业)时遇到相同的问题。
I echo Mike's solution - add the project output files into the project manually. 我回应Mike的解决方案-手动将项目输出文件添加到项目中。 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).
如果您引用“ / bin / Release”项目二进制文件,则无论如何它将始终包含最新副本(前提是您在安装程序之前构建了项目)。 Turns out you don't need a copy of the .winmd in the application directory for it to run correctly.
事实证明,在应用程序目录中不需要.winmd的副本即可正常运行。
You can produce the GUI version of the 80070057 error by trying to add a .winmd file by hand to any installer project. 您可以通过尝试将.winmd文件手动添加到任何安装程序项目中来产生80070057错误的GUI版本。
解决方案是将生成文件(.exe和.dll)复制/粘贴到部署项目的文件系统中,而不是让部署项目生成项目输出。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.