Reputation: 8115
When Build Project. Error The "RazorGenerate" task failed unexpectedly. .Net Core 2.2
Upvotes: 74
Views: 18792
Reputation: 1387
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.
Upvotes: 106
Reputation: 643
It worked on the build server, after I added this Nuget package:
Microsoft.NET.Sdk.Razor
Since I added the Net.SDK.Razor package, it builds successfully.
I had also added Microsoft.AspNetCore.Razor.Design, but only Microsoft.NET.Sdk.Razor is actually needed.
Upvotes: 36
Reputation: 1296
I did 3 steps to get it to build AND to get the ( ~/ ) variable to work.
Upvotes: 47