Vs compile time razortaghelper – dotnet_ HOST_ PATH is not set

Time:2022-1-9

Today, I heard from my friend that I had a problem and opened oneaspnetcore2.2The project is very interesting, lacking environmental variablesDOTNET_HOST_PATH

file

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 enterset, as shown in the figure below, we will see the operating environment variables of the current operating system:

file

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:

file

Well, it’s ready. Now we can restart vs and try to regenerate it~

Recommended Today

The whole tutorial of docker installation and use, installation / complete command / dockerfile image production / docker container arrangement and one click installation of nginx + redis + MySQL / visualizer portal (version 2022)

官网: https://docs.docker.com/ 官网: https://www.docker.com/ docker 镜像市场: https://hub.docker.com/ 一、docker 说明 1.1、docker 核心 1、Docker 是一个开源的应用容器引擎,基于 Go 语言 并遵从 Apache2.0 协议开源,Docker 是一个 CS 架构软件。 2、Docker 是一个虚拟化轻量级linux服务器,可以解决我们在开发环境中运行配置问题 3.、Docker的主要目标是‘build ,ship and run any app,anywhere’,一次封装,到处运行 4、容器是完全使用沙箱机制,相互之间不会有任何接口(类似 iPhone 的 app),更重要的是容器性能开销极低。 1.2、docker 版本问题 .Docker 从 17.03 版本之后分为 CE(Community Edition: 社区版) 和 EE(Enterprise Edition: 企业版),我们用社区版就可以了。 1.3、docker 架构( 3大核心) · 1、Images 镜像 (等于软件) · 2、Registry […]