2

After windows update to 1909, getting this error while building my solution in VS Studio 2019

Error Details

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\2019\Professional\MSBuild\Current\Bin\amd64\MSBuild.exe" exists and can be run.

Windows version: 1909
Upgraded from 1803

Visual Studio version: Visual Studio Professional 2019 version 16.7.5

Please let me know anyone encountered this issue earlier, any help will be appreciated.

大陸北方網友
  • 3,696
  • 3
  • 12
  • 37
Tony Tom
  • 1,435
  • 1
  • 10
  • 17

2 Answers2

1

Try to add these node in xxx.csproj file:

<PropertyGroup> 

<GenerateResourceMSBuildArchitecture>CurrentArchitecture</GenerateResourceMSBuildArchitecture>
<GenerateResourceMSBuildRuntime>CurrentRuntime</GenerateResourceMSBuildRuntime>
    
</PropertyGroup>

More steps about this issue, you can refer to this similar issue.

To be more specific, set an system environment variable DisableOutOfProcTaskHost to true.

Or DISABLEOUTOFPROCTASKHOST to 1.

Mr Qian
  • 21,064
  • 1
  • 31
  • 41
  • Thanks Perry Qian-MSFT for the answer, There are multiple projects in my solution, So I am looking for a solution which doesn't require to change the .csprj files. found this solution which will suppress the error and helps in building the project This can be used as an environment variable, which will avoid changing the .csprj files key "DISABLEOUTOFPROCTASKHOST" value 1. Still looking for a better solution, because it worked perfectly before the windows upgrade. And I have the CLR4 and MSBuild present which mentioned in the error details. – Tony Tom Oct 12 '20 at 09:01
  • More similar with [this issue answered by me](https://stackoverflow.com/questions/64295288/could-not-run-the-generateresource-task-because-msbuild-could-not-create-or-co). Actually, the runtime of this specific project has some accidental error since you have upgraded your OS. It is complex to explain that and upgrading os does cause the build and operation mechanism of some projects. And so far, the best solution is to add those node or just set an environment variable called `DisableOutOfProcTaskHost`. – Mr Qian Oct 12 '20 at 09:22
  • And [this issue](https://stackoverflow.com/questions/44909874/dotnet-build-error-after-migrating-dotnetcore-project-to-1-0-4) will provide some info. Also, you can check in your solution and locate which projects have these problems. And these tips are better workaround so far. If you cannot find a better solution than them, I suggest you could accept it. – Mr Qian Oct 12 '20 at 09:25
0

as I said in here

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.