Today, I heard from my friend that I had a problem and opened one
aspnetcore2.2The project is very interesting, lacking environmental variables
seriousness code explain project file that 's ok Disable display status error MSB4018 The 'razortaghelper' task failed unexpectedly. System.InvalidOperationException: DOTNET_HOST_PATH is not set In Microsoft AspNetCore. Razor. Tasks. DotNetToolTask. get_ DotNetPath() In Microsoft AspNetCore. Razor. Tasks. DotNetToolTask. GenerateFullPathToTool() In Microsoft Build. Utilities. ToolTask. ComputePathToTool() In Microsoft Build. Utilities. ToolTask. Execute() In Microsoft AspNetCore. Razor. Tasks. DotNetToolTask. Execute() In Microsoft Build. BackEnd. TaskExecutionHost. Microsoft. Build. BackEnd. ITaskExecutionHost. Execute() In Microsoft Build. BackEnd. TaskBuilder. d__ 26.MoveNext() YiSha. Admin. Web C:\Users\hueif\. nuget\packages\microsoft. aspnetcore. razor. design.2.0\build\netstandard2. 0\Microsoft. AspNetCore. Razor. Design. CodeGeneration. targets seventy-nine
Now let’s see if our operating system lacks this environment variable.
We open the console and enter
set, as shown in the figure below, we will see the operating environment variables of the current operating system:
Well, I don’t see. The error message is very clear. Let’s solve it.
We use setx to add our dotnet path in windows,
/mThe parameter is to add a system variable, as shown below:
setx "DOTNET_HOST_PATH" "%ProgramFiles%\dotnet\dotnet.exe" /m
Now let’s check whether our system variable has been added successfully:
Well, it’s ready. Now we can restart vs and try to regenerate it~