简体   繁体   English

当主项目具有任何.winmd引用时,无法生成Visual Studio Installer项目

[英]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.

相关问题 Visual Studio 找不到新项目的任何引用 - Visual Studio cannot find any references for a new project 引用Visual Studio项目 - References the Visual Studio Project Visual Studio-Windows 8.1项目错误-错误APPX1704:.winmd文件'Windows.winmd' - Visual studio - windows 8.1 project error - error APPX1704: The .winmd file 'Windows.winmd' Visual Studio可以将项目引用编译到与主.exe不同的文件夹中 - Can Visual Studio compile project references into a different folder then the main .exe Visual Studio 2017安装程序项目未显示任何依赖项 - Visual Studio 2017 Installer Project not showing any dependencies 有人征服了VS2019中的Visual Studio安装程序项目吗? - Has anyone conquered the Visual Studio installer project in VS2019? 无法在Visual Studio中构建C#项目 - Cannot build C# project in Visual Studio Visual Studio 2012无法构建引用其他项目的新项目 - Visual Studio 2012 Fails To Build New Project That References Other Projects 在Visual Studio中使用引用调试项目 - debug a project with references in Visual studio 如何为Visual Studio 2015创建安装程序项目,该项目将安装到与主项目同名的目录中? - How to create an installer project for visual studio 2015 which will install into a directory of the same name as the main project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM