Problem
After updating Rider, project builds may fail with the following error message
Error MSB4216 : Could not run the "<Name>" task because MSBuild could not create or connect to a task host with runtime "NET" and architecture "<Architecture>". Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "C:\Program Files\dotnet\sdk\<version>\MSBuild.dll" exists and can be run.
Cause
This issue typically occurs if Rider auto-detects an incorrect MSBuild instance for the project — chosen MSBuild instance doesn't have the necessary runtime components.
Resolution
To resolve this, Rider can be configured manually to use a different MSBuild version. To resolve the issue, try switching to different MSBuild in the Settings | Build, Execution, Deployment | Toolset and Build | MSBuild version list:
- Navigate to Settings | Build, Execution, Deployment | Toolset and Build | MSBuild version
- Select the MSBuild instance required for the affected project using the MSBuild version dropdown menu
- For example, one can choose MSBuild bundled with a Visual Studio installation. The path usually resembles
C:\Program Files\Microsoft Visual Studio\<version>\MSBuild\Current\Bin\MSBuild.exe, assuming a default Visual Studio installation.
- For example, one can choose MSBuild bundled with a Visual Studio installation. The path usually resembles
- After changing the MSBuild version, attempt to rebuild the project to confirm the issue is resolved.
Comments
0 comments
Please sign in to leave a comment.