我正在使用VisualStudio2017企业版15.7.1和.NET Framework4.5。
我刚刚安装了Windows10UpdateVersion10.0.18363构建18363。
我可以在相同的解决方案中构建其他项目,但是对于这个项目,我在构建时会得到这个错误。
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(3045,5):
error MSB4216:
Could not run the "GenerateResource" task because MSBuild could not create or connect to a task host with runtime "CLR4" and architecture "x64".
Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64\MSBuild.exe" exists and can be run.
Error MSB4028 The "GenerateResource" task's outputs could not be retrieved from the "FilesWritten" parameter.
Object does not match target type. my-project-name C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 3066
我怎么才能解决这个问题?谢谢。
发布于 2020-10-12 06:59:49
试试看:
1)将这些xxx.csproj
节点添加到xxx.csproj
文件中:
<PropertyGroup>
<GenerateResourceMSBuildArchitecture>CurrentArchitecture</GenerateResourceMSBuildArchitecture>
<GenerateResourceMSBuildRuntime>CurrentRuntime</GenerateResourceMSBuildRuntime>
</PropertyGroup>
2)添加一个名为DisableOutOfProcTaskHost
的系统环境变量,并将其值设置为true
。
或将DISABLEOUTOFPROCTASKHOST
设置为1
。
3),因为您的VS2017太老了,我建议您可以将VS2017更新为最新版本,以防出现一些修复。或修理vs.
也是,确保您已经在vs安装程序中安装了Workload.Net Core跨平台开发。
4)关闭VS,删除解决方案文件夹下的.vs
隐藏文件夹,bin
和obj
文件夹,然后重新启动VS以再次测试。除了Configuration之外,您还可以将目标框架版本更改为net framework 4.6.1
,将更改为Any CPU
。
发布于 2021-04-02 16:21:14
我也犯了同样的错误(在16.9.3版中),但是通过修复VisualStudio2019,更新最后版本的windows 10,关闭VS,删除.vs隐藏文件夹(在解决方案文件夹下),bin和obj文件夹,然后重新启动VS。幸运的是我的问题解决了。
https://stackoverflow.com/questions/64295288
复制相似问题