Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

got error " The "RazorGenerate" task failed unexpectedly. " .After Updating to VS 16.8 and upgrade to .net 5.. the core version target is Core 2.2

Tags:

.net-core

enter image description here

When Build Project. Error The "RazorGenerate" task failed unexpectedly. .Net Core 2.2

like image 498
Nader Gharibian Fard Avatar asked Nov 11 '20 06:11

Nader Gharibian Fard


2 Answers

The fix for me was to introduce a new System Environment Variable with the Key "DOTNET_HOST_PATH" and the value "dotnet" and then to restart Visual Studio.

like image 82
Rob Powell Avatar answered Nov 10 '22 19:11

Rob Powell


I did 3 steps to get it to build AND to get the ( ~/ ) variable to work.

  1. Open cmd and write this: setx DOTNET_HOST_PATH "%ProgramFiles%\dotnet\dotnet.exe"
  2. Open C:\Program Files\dotnet\sdk in here delete the folder: NuGetFallbackFolder
  3. Restart your pc!
like image 46
Yasser Bazrforoosh Avatar answered Nov 10 '22 19:11

Yasser Bazrforoosh