错误MSB4062:"SetEnv"消息不正确.无法从程序集中加载任务 [英] Error MSB4062: The "SetEnv" task could not be loaded from the assembly
问题描述
因此,我试图安装一个名为Better-sqlite-pool的Node包,但是遇到了我似乎无法解决的错误.每当我运行 npm我更好的-sqlite-pool 时,都会出现以下错误:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140\Microsoft.Cpp.Current.targets(64,5): error MSB4062: The "SetEnv"
task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140\Microsoft.Build.CppT
asks.Common.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, Pu
blicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the
<UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contain
s a public class that implements Microsoft.Build.Framework.ITask. [D:\Files\ScrimsBot\node_modules\integer\build\intege
r.vcxproj]
我对此进行了广泛的研究,并且尝试了几乎所有建议的修补程序,但均未成功.
我收到的第一个错误设法通过添加环境变量 VCTargetsPath 并将其设置为 C:\ Program Files(x86)\ MSBuild \ Microsoft.Cpp \ v4来解决. 0 \ v140 .在执行此操作之前,我收到以下错误:
The imported project "D:\Microsoft.
Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exist
s on disk.
我尝试的另一件事是使用 npm install -g --production Windows-build-tools 命令安装构建工具,但这没什么区别.
可能值得注意的是,我已经安装了用于台式机组件的 VC ++ 2015.3 v14.00(v140)工具集安装了Visual Studio 2017 Enterprise.
我有一个类似的问题,并且在同一时间获得了库存.我在这里在此处找到解决方案:>
- 也安装Visual Studio 2015
- 在与exe相同的目录中创建.config文件(如果尚未安装),其中包含msbuild程序集的绑定重定向
第一个选项对我有用:
- 使用当前用户的管理员提示,而不是提升受限用户的权限,如果这样做的话,路径将很混乱
-
npm install --global --production --vs2015 windows-build-tools
-
npm install --global --production windows-build-tools
(此文件在安装过程中被卡住,请使用ctrl-c结束安装) -
npm install --global --production windows-build-tools
(是的,再次使用同一命令完成配置) -
npm config set msvs_version 2015 --global
由于我不是一个真正的程序员,所以我不知道从哪个选项开始.
So I am trying to install a Node package called better-sqlite-pool, however I am stuck with an error which I can't seem to resolve. Whenever I run npm i better-sqlite-pool, I get the following error:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140\Microsoft.Cpp.Current.targets(64,5): error MSB4062: The "SetEnv"
task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140\Microsoft.Build.CppT
asks.Common.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, Pu
blicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the
<UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contain
s a public class that implements Microsoft.Build.Framework.ITask. [D:\Files\ScrimsBot\node_modules\integer\build\intege
r.vcxproj]
I have done extensive research on this, and have tried pretty much all of the suggested fixes to no success.
The first error I received I managed to fix by adding an environment variable of VCTargetsPath and setting it to C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140. The error I received before doing this was the following:
The imported project "D:\Microsoft.
Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exist
s on disk.
Another thing I tried was installing the build tools using the npm install -g --production windows-build-tools command however that made no difference.
It is probably worth noting that I have Visual Studio 2017 Enterprise installed with the VC++ 2015.3 v14.00 (v140) toolset for desktop component installed.
I have a rather similar issue, and got stock at the same point. I found two possible solutions over here:
- install Visual Studio 2015 as well
- create .config file in the same dir as your exe (if you don't have it already) containing binding redirection of msbuild assemblies
The first option works for me:
- use an administrator prompt from the current user, don't elevate from a limited user, the paths will be a mess if you do that
npm install --global --production --vs2015 windows-build-tools
npm install --global --production windows-build-tools
(this one gets stuck during the installation, ctrl-c to end it)npm install --global --production windows-build-tools
(yes, the same command again to finish the configuration)npm config set msvs_version 2015 --global
Since I'm not a real programmer I wouldn't know where to begin for the latter option.
这篇关于错误MSB4062:"SetEnv"消息不正确.无法从程序集中加载任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!