After upgrading to Visual studio 16.8.0 some of your projects depending on Netstandard 2.0 may not build due to Razor Tag Helper task failing.
The Output Window will show a message containing the following:-
MSB4018 The RazorTagHelper task failed unexpectedly.
The Fix
- Install 3.1 SDK of .NET Core. Can be located from the following link:- https://dotnet.microsoft.com/download/dotnet-core/3.1
- Add global.json file to your visual studio project and add the following to it to pin the project to 3.1 SDK:-
{
"sdk": {
"version": "3.1.403"
}
}
To Reproduce
Open an existing .NET Core 2.2 app in VS 16.8.0
Build the project.
The Error will be displayed in the Error window and the project cannot be run.