Dot-Net
無法執行“GenerateResource”任務,因為 MSBuild 無法創建或連接到執行時“CLR4”和體系結構“x64”的任務主機
我正在使用 Visual Studio 2017 Enterprise 版本 15.7.1 和 .NET Framework 4.5。
我剛剛安裝了 Windows 10 更新版本 10.0.18363 build 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我怎樣才能解決這個問題 ?謝謝你。
試試這些:
1)
xxx.csproj在您的文件中添加這些 xml 節點:<PropertyGroup> <GenerateResourceMSBuildArchitecture>CurrentArchitecture</GenerateResourceMSBuildArchitecture> <GenerateResourceMSBuildRuntime>CurrentRuntime</GenerateResourceMSBuildRuntime> </PropertyGroup>**2)**添加一個名為的系統環境變數
DisableOutOfProcTaskHost並將其值設置為true.或設置
DISABLEOUTOFPROCTASKHOST為1.3)由於你的VS2017太舊,我建議你可以將你的VS2017更新到最新版本,以防有一些修復。或修復與。
另外,請確保您已在 vs 安裝程序中安裝了工作負載**.Net Core 跨平台開發。**
4)關閉VS,刪除
.vs解決方案文件夾下的隱藏文件夾,bin文件obj夾然後重新啟動VS再次測試。此外,您可以將目標框架版本net framework 4.6.1和配置更改為Any CPU.
