在VS2017中出现MSB4057错误,提示项目中不存在"CreateManifestResourceNames"目标。

5
当使用VS2017创建有状态解决方案并生成标准样板代码时,生成的两个项目具有不同的MSBuild版本。 应用程序使用MSBuild版本1.5.0。 服务使用MSBuild版本1.6.0(当前的“最新”版本)。
如果按照这种方式运行解决方案,则可以在本地Service Fabric集群上正常运行。
但是,当我使用NuGet将应用程序的MSBuild更新到1.6.0(使应用程序和服务器项目都使用相同的版本)后,会出现以下错误。
Severity Code Description Project File Line Suppression State
Error  The OutputPath property is not set for project 'gt_strd5.sfproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Debug'  P follow a project-to-project reference to this project, this project has belatform='x64'.  This error may also appear if some other project is trying toen unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform. gt_strd5 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 737 

Severity Code Description Project File Line Suppression State
Error MSB4057 The target "CreateManifestResourceNames" does not exist in the project. gt_strd5 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 2630

2个回答

2
我发现修改后,应用程序的项目文件中仍然有一些引用继续引用MSBuild 1.5.0版本。在我的情况下,gt_strd5.sfproj文件包含了四个引用,需要将其从1.5.0版本更新到1.6.0版本。请参见以下XML片段。
Import Project="..\packages\Microsoft.VisualStudio.Azure.Fabric.**MSBuild.1.5.0**\build\Microsoft.VisualStudio.Azure.Fabric.Application.props" Condition="Exists('..\packages\Microsoft.VisualStudio.Azure.Fabric.**MSBuild.1.5.0**\build\Microsoft.VisualStudio.Azure.Fabric.Application.props')"
.....
Import Project="..\packages\Microsoft.VisualStudio.Azure.Fabric.**MSBuild.1.5.0**\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.Azure.Fabric.**MSBuild.1.5.0**\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets')"

为了验证这一点,我回头试了几次,并且能够重现这个问题和解决方案。希望这能为其他人节省一些时间。 最好的祝福。

2
我在PCF控件中遇到了这个错误。
运行开发人员命令提示符VS2017/VS2019。
a) 从cmd行中删除文件夹中的空格,例如源控制生成的名称Test%20-%20PCFs应更改为TestPCFs。
b) 进入pcf项目文件夹并运行msbuild /t:restore。
b) 进入cds项目文件夹并运行msbuild /t:restore。
c) 在cds项目文件夹中运行msbuild。
d) 对于发布部署,请运行msbuild /p:configuration=Release。
对于其他类型的项目:
a) 删除文件夹名称中的空格。
b) 运行msbuild /t:restore。
c) 运行msbuild。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接