Could not run the GenerateResource task because MSBuild could not create or connect
ERROR MSB4017: Could not run the GenerateResource task because MSBuild could not create or connect to a task host with runtime CLR2 and architecture x86.- Article by Kunal Chowdhury on
In case you are facing the following error MSB4017: Could not run the "GenerateResource" task because MSBuild could not create or connect, while building your project/solution in Visual Studio, this could be because the build system is running out of the build process.
To resolve this error, there could be two different approaches. In this quick note, sharing both the solutions for your easy reference.
While building projects/solutions in Visual Studio, the build may break with the following error log:
ERRORMSB4017
: Could not run the "GenerateResource" task because MSBuild could not create or connect to a task host with runtime "CLR2" 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:\Program Files (x86)\MSBuild\14.0\bin\MSBuildTaskHost.exe
" exists and can be run.
This may happen when the build system is running out of the build process. This is a feature introduced in Visual Studio 2012 and the error can happen in older versions too. To resolve this error, you need to disable the out of process task host.
How to resolve the issue?
To resolve it, go to all your .csproj
file where the error is occuring and add the following line under the default property group:
<PropertyGroup> .... .... <DisableOutOfProcTaskHost>true</DisableOutOfProcTaskHost> </PropertyGroup>
Alternative approach to resolve the issue
Alternatively, you can perform the following steps to disable the out of process task host for all users in that system:
- Click on the
Start button. - Right-click on
Computer and then navigate toProperties |Advanced system settings . - Click
Environment Variables... button to open the dialog. - Now, under the
System variables panel, clickNew... button. - Enter the
Variable name asDISABLEOUTOFPROCTASKHOST
, and enter theVariable value as1
. - Click
OK |OK |OK to save the configurational details. - You may have to restart the system in order to apply the configurational changes.