Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSB4018 The "RazorGenerate" task failed unexpectedly

Tags:

asp.net-core

I have updated my visual studio 2019 to latest version with .net 5 after that any project with .net core 2.2 gives this error Error MSB4018 The "RazorGenerate" task failed unexpectedly. System.InvalidOperationException: DOTNET_HOST_PATH is not set at Microsoft.AspNetCore.Razor.Tasks.DotNetToolTask.get_DotNetPath()

After one day try to run the project i find out that you have to install from huget PackageReference Include="Microsoft.NET.Sdk.Razor" Version="2.2.0" to solve the problem

like image 206
Work Test Avatar asked Nov 13 '20 20:11

Work Test


2 Answers

After one day try to run the project i find out that you have to install from nuget PackageReference Include="Microsoft.NET.Sdk.Razor" Version="2.2.0" to solve the problem

like image 157
Work Test Avatar answered Oct 22 '22 12:10

Work Test


This is something issue with VS. for me I have added 'DOTNET_HOST_PATH' path with %ProgramFiles%\dotnet\dotnet.exe . and restarted . problem solevd

like image 31
CodeMind Avatar answered Oct 22 '22 11:10

CodeMind