0

I am using VS 2019. Once the project is cloned from bitbucket, I am able to build the solution. If I try to build after cleaning the solution or rebuild, I am getting this error.

Severity Code Description Project File Line Suppression State Error Could not run the "LC" 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.

I have updated VS but it did not help.

  1. Updated VS 2019
  2. deleted .vs folder obj folder and debug folder
  3. restarted the machine

1 Answers1

0

Based on experience,

  1. You can try to add the following code in the csproj file: (unload the project, then double-click the project to enter)
<PropertyGroup>
   <GenerateResourceMSBuildArchitecture>CurrentArchitecture</GenerateResourceMSBuildArchitecture>
   <GenerateResourceMSBuildRuntime>CurrentRuntime</GenerateResourceMSBuildRuntime>
</PropertyGroup>
  1. Add an environment variable DisableOutOfProcTaskHost and set its value to true. Or set it to 1.

Update:

It was due to crowdstrike running in the machine.

Jiale Xue - MSFT
  • 3,560
  • 1
  • 6
  • 21
  • I tried with these steps, but no luck – Roopa Rai Jan 18 '23 at 08:47
  • Do you have any extensions installed that affect msbuild, try disabling them. You can also try to reinstall vs2019 using installer, but I suggest you use the latest version of 2022. This link may help you. https://developercommunity.visualstudio.com/t/msbuild-amd-x64-not-working/1387989?viewtype=solutions – Jiale Xue - MSFT Jan 18 '23 at 09:02
  • i have installed VS 2022 yesterday, still same issue. Need to check on extensions – Roopa Rai Jan 18 '23 at 09:04
  • Maybe you need to try removing msbuild, and reinstall https://learn.microsoft.com/en-us/visualstudio/msbuild/walkthrough-using-msbuild?view=vs-2022#install-msbuild. Do you have the same problem in your new program? – Jiale Xue - MSFT Jan 18 '23 at 09:05
  • I found an issue similar to yours, you can try to see if it solves your problem. https://stackoverflow.com/a/64313043/16764901 – Jiale Xue - MSFT Jan 18 '23 at 09:08
  • Thank you so much for your help. Issue is resolved now. It was due to crowdstrike running in the machine. – Roopa Rai Jan 19 '23 at 09:31
  • I have edited the answer,you could mark it as the answer. Thanks. That would help the person has the same issue. – Jiale Xue - MSFT Jan 19 '23 at 09:47