The "RazorTagHelper" task failed unexpectedly"

When working with Visual Studio following error might occur:

"MSB4018 The "RazorTagHelper" task failed unexpectedly"

To fix it, please add the environment variable DOTNET_HOST_PATH with the value dotnet. Then restart the Visual Studio.

If this does not work, pleas add the named variable to the system environment variables.