Work Test
Work Test

Reputation: 291

MSB4018 The "RazorGenerate" task failed unexpectedly

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

Upvotes: 17

Views: 2429

Answers (2)

CodeMind
CodeMind

Reputation: 646

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

Upvotes: 1

Work Test
Work Test

Reputation: 291

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

Upvotes: 12

Related Questions