Can't run GenerateResource Task
See original GitHub issueFrom @NTaylorMullen on November 1, 2016 0:30
After dotnet migrate
ing Microsoft.AspNetCore.Razor.Design attempting to restore3/build3 results in the following error:
C:\Users\nimullen\AppData\Local\Microsoft\dotnet\sdk\1.0.0-preview3-003892\Microsoft.Common.CurrentVersion.targets(2801,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 "x86". Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "C:\Users\nimullen\AppData\Local\Microsoft\dotnet\sdk\1.0.0-preview3-003892\MSBuild.exe" exists and can be run. [C:\Users\nimullen\Documents\GitHub\RazorTooling\src\Microsoft.AspNetCore.Razor.Design\Microsoft.AspNetCore.Razor.Design.csproj]
I thought I recalled seeing an issue associated with GenerateResource task being unable to run but I can no longer find it. Feel free to move or close this issue as a duplicate.
Dotnet info:
.NET Command Line Tools (1.0.0-preview3-003892)
Product Information:
Version: 1.0.0-preview3-003892
Commit SHA-1 hash: 5301f08423
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Copied from original issue: dotnet/cli#4556
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (10 by maintainers)
Top GitHub Comments
Workaround: define this property
in your project.
The problem is that
CoreResGen
has logic to attempt to find the rightresgen.exe
(it matters because you want to use the right bitness + framework version for what you’re targeting). That logic only works if there are multiple task hosts available, though, which isn’t true in .NET Core MSBuild.I think setting that property in an SDK .props/.targets is the right fix for this. .NET Core builds should use the
CurrentArchitecture
because that’s the only one that’s guaranteed to be runnable.One wrinkle: I’m not entirely sure what differs when a different resgen runs. I think it’s ok to just use the one that works, but I don’t understand it deeply.
I had the same Error (in version 16.9.3) but By Repairing Visual Studio 2019, Updating last version of windows 10, close VS, delete .vs hidden folder (under solution folder) ,bin and obj folder then restart your VS . Fortunately My problem was solved.