Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSB4018 The RazorTagHelper task failed unexpectedly - after VS upgrade #27249

Closed
gregoryagu opened this issue Oct 27, 2020 · 5 comments
Closed
Labels
area-razor.compiler This issue is related to the Razor compiler (now external) feature-razor.vs

Comments

@gregoryagu
Copy link

After upgrading to the Latest Preview of VS, I opened an existing project that compiled successfully in prior version of VS. It showed and error message in the error list which I have not been able to resolve.

Note that others have had the same issue: https://stackoverflow.com/questions/64354562/vs-2019-fails-to-build-project

Describe the bug

MSB4018 The RazorTagHelper task failed unexpectedly.

Output window shows this message:
2>C:\Users\Greg.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(79,5): error MSB4018: The "RazorTagHelper" task failed unexpectedly.
2>C:\Users\Greg.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(79,5): error MSB4018: System.InvalidOperationException: DOTNET_HOST_PATH is not set

To Reproduce

Open an existing .net core 2.2 app in VS 16.8.0 Preview 5.0.
Build the project.
The Error will be displayed in the Error window and the project cannot be run.

@NTaylorMullen NTaylorMullen added area-razor.compiler This issue is related to the Razor compiler (now external) and removed area-razor.tooling labels Oct 28, 2020
@pranavkm
Copy link
Contributor

@gregoryagu it looks like there are changes to the 5.0 SDK that make it incompatible with .NET Core 2.2 apps. While we attempt to avoid such incompatibilities, ASP.NET Core 2.2 has been out of support for some time now so it's difficult for us to capture these kinds of regressions.

  • We would strongly encourage targeting a supported version of ASP.NET Core to ensure continued support.
  • As a short term fix, you can acquire a 3.1 SDK (from https://dotnet.microsoft.com/download/dotnet-core/3.1) and add a global.json file to your project to pin the SDK.
{
  "sdk": {
    "version": "3.1.403"
  }
}

@gregoryagu
Copy link
Author

gregoryagu commented Oct 30, 2020

Ok, thank you for the reply, will close.

@EnginYuvaktas
Copy link

installing Microsoft.NET.Sdk.Razor is fixed my issue

@sdktraceur
Copy link

sdktraceur commented Nov 28, 2020

@EnginYuvaktas Thank you! +1

@stefanro2000
Copy link

@EnginYuvaktas it compiled, thanks for your solution

@ghost ghost locked as resolved and limited conversation to collaborators Jan 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-razor.compiler This issue is related to the Razor compiler (now external) feature-razor.vs
Projects
None yet
Development

No branches or pull requests

6 participants