-
Notifications
You must be signed in to change notification settings - Fork 10k
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
RazorTagHelper - DOTNET_HOST_PATH is not set #28333
Comments
I got same problem too. anyone can help? |
I doubt this is a permanent or proper solution, but I got rid of the error by adding a system environment variable named DOTNET_HOST_PATH with a value of dotnet. There are several ways in Windows to get to the spot where you can add system environment variables. Either use the Windows search (enter system environment variable in the search box) or get there via Control Panel -> System -> Advanced System Properties and then Environment Variables button. All I can say is by doing the above my program would again build. NOTE: I did have to close down visual studio and reload it after adding the variable in order for things to start working. EDIT: While the manual addition of DOTNET_HOST_PATH did get my project to build, there were issues when I ran it. The paths for all of the static files within wwwroot were incorrect; they all had an unwanted segment in the path ("~/"). |
We are using ASP.NET Core 2.2 with .NET Framework 4.6.1 and I get the same exception with Visual Studio 2019 16.8.0. Severity Code Description Project File Line Suppression State |
目录路径:C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\ 删除上面目录以下两个文件: ps:文件路径因人而异 |
Microsoft's own sample app https://github.com/Azure-Samples/service-fabric-dotnet-quickstart/ wont compile after VS was upgraded (.NET 4.7.2 in these projects). |
Added the following environment variable to my user environment to make it build again: |
@olivermue thanks a lot! It solved my problem too. I have an ASP.NET Core Project targeting 2.2 and I got the error from the issue after installing .Net 5.0 yesterday. Funny is, that the project was successfully built using dotnet CLI without the DOTNET_HOST_PATH env. variable. |
I added DOTNET_HOST_PATH as dotnet, and it also solved after restarting VS twice. |
I faced the same issue after update VS to the latest version 16.8 and after apply the @olivermue solution I was able to compile and run the web app, however any of the javascript and styles files are loaded correctly now :(. |
It´s a problem on Razor to recognize new env variable. |
It was worked for me |
It is not working. solution is environment editing |
|
I got the same issue and had to manually set the
|
Thanks. |
Getting the same error in Visual Studio for Mac 8.8 Is there a known workaround for this? I can't figure out how to set the environment variable on mac... |
@augustoproiete reply was helpful for me.
|
I'm on Mac, not windows. |
Not sure this issue should be under the SDK project. Is there an open issue on the developer community? |
@dathway I'd guess that on OSX it would look something similar to
You should be able to run |
Thank you, but I've tried this and it does not work. Still stuck. All of my projects which target dotnet core 3.1 are unaffected, just the ones at 2.2 |
same here, using Mac and exporting the DOTNET_HOST_PATH doesn't seem to resolve the build issue |
Using vs mac fails, but using vs code is normal. |
I did 3 steps to get it to build AND to get the ( ~/ ) variable to work.
|
I'm having the same problem |
Anyone found a solution for osx (10.15.6) / vs 16.8.0 (8.8 for mac) / aspnetcore 2.2 project ? Same problem after deleted NuGetFallbackFolder folder, added export DOTNET_HOST_PATH in .profile or .bash_profile, .zshrc, .zprofile, seen the variable in 'env', added in run 'custom configuration'. Edit: dotnet run in terminal works fine. vs code attaching process for debug also works. visual studio 8.8 didn't work. Edit 2: when I changed build proccess to verbose mode in VS 8.8, the only variable with dotnet are DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR = /usr/local/share/dotnet. Edit 3: Running in terminal works fine: dotnet msbuild /p:MSBuildExtensionPath='/Users/xxx/Library/Caches/VisualStudio/8.0/MSBuild/8639_1/MonoDevelop.MSBuildBuilder.exe' /p:Configuration=Debug /v:diag Tried to force this variable in .csproj file but no success running in VS 8.8 in OSX, the variable was never there. Edit 4: Finally.... now I was able to run in VS 8.8 in OSX. Add after < Project> in .csproj < PropertyGroup> Edit 5: I had delete the above configuration because after closing VS, I got the same error.... The final solution for me: open the terminal, go to the project folder and run: dotnet msbuild /p:MSBuildExtensionPath='/Users/brunokenj/Library/Caches/VisualStudio/8.0/MSBuild/8639_1/MonoDevelop.MSBuildBuilder.exe' /p:Configuration=Debug /v:diag After that command, seems msbuild in vs can read the DOTNET_HOST_PATH variable (from .profile file?) and build the web project. |
It Was worked too me! Thanks |
Any suggestion how to solve this for a solution that both contains a Microsoft.NET.Sdk.Razor project and F# class libraries. Because setting DOTNET_HOST_PATH environment variable interfere with running the F# compiler as discussed here dotnet/fsharp#10447 |
Thanks. If someone is using a build agent or building in a service, the command must have a /M to make it system wide and not only local:
|
I added a comment to the thread on the VS developer community site (link below) with an update on how I got things to work for me. Essentially I got rid of a nuget package in my local cache and things worked without the DOTNET_HOST_PATH system environment variable. The only "gotcha" was if I did a rebuild all on my solution, the package was re-added to my local nuget cache and the problem returned. Deleting the cached package (again) did (again) fix things -- at least for me. Updating the project file as follows seems to have resolved things for me. DOTNET_HOST_PATH environment variable not needed with this change:
|
Adding Microsoft.NET.Sdk.Razor to my Web project worked for me |
This is the most simple solution. Worked for me without restarting the VS or the PC. |
This worked for me on Visual Studio For Mac. |
I'm new here so I don't know where to add that line. Please give me more specific info |
@nqdung16 |
I got it. Thanks |
On mac, I fixed it with running the project from bash |
Adding this line in project file works or install razor package: reference: https://stackoverflow.com/questions/64827539/msb4018the-razorgenerate-task-failed-unexpectedly |
Thanks! |
My issue resolved. Thanks. |
Worked like a Charm !! |
Thank you for the issue report. We inadvertently broke support for ASP.NET Core 2.2 as part of the 5.0 SDK which is why you're seeing this error. We're addressing this in 5.0.2 which is set to be released early next month. In the meanwhile there are a few workaround:
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="2.2.0" />
I would like to add that .NET Core 2.2 has been out of support for some time now and is no longer receiving any updates (including security fixes). You should consider migrating to a supported releases (2.1, 3.1 or 5.0) to continue to be supported. |
This was resolved in macOS Catalina. Version 10.15.7 For those who have not yet managed to define the environment variable, enter this site that will help a lot. To resolve the |
After updating VS 2019 16.8.0 I'm facing this error on compilation on any project:
Web C# .net core 2.2
Erro MSB4018 Falha inesperada da tarefa "RazorTagHelper".
System.InvalidOperationException: DOTNET_HOST_PATH is not set
em Microsoft.AspNetCore.Razor.Tasks.DotNetToolTask.get_DotNetPath()
em Microsoft.AspNetCore.Razor.Tasks.DotNetToolTask.GenerateFullPathToTool()
em Microsoft.Build.Utilities.ToolTask.ComputePathToTool()
em Microsoft.Build.Utilities.ToolTask.Execute()
em Microsoft.AspNetCore.Razor.Tasks.DotNetToolTask.Execute()
em Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
em Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() QRPlus C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets 79
Anyone knows whats is going on?
The text was updated successfully, but these errors were encountered: