Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何安装&x27;Node-JS-Tools';使用dotnetcli_Node.js_.net_Msbuild_Continuous Integration_Gitlab - Fatal编程技术网

Node.js 如何安装&x27;Node-JS-Tools';使用dotnetcli

Node.js 如何安装&x27;Node-JS-Tools';使用dotnetcli,node.js,.net,msbuild,continuous-integration,gitlab,Node.js,.net,Msbuild,Continuous Integration,Gitlab,我们正在构建一个ASP.NET核心解决方案,最近我们在该解决方案中添加了一个NodeJS项目。现在,当我们运行CI时,会出现以下错误: error MSB4019: The imported project "/usr/share/dotnet/sdk/3.1.201/Microsoft/VisualStudio/v16.0/Node.js Tools/Microsoft.NodejsToolsV2.targets" was not found. Confirm that the express

我们正在构建一个ASP.NET核心解决方案,最近我们在该解决方案中添加了一个NodeJS项目。现在,当我们运行CI时,会出现以下错误:

error MSB4019: The imported project "/usr/share/dotnet/sdk/3.1.201/Microsoft/VisualStudio/v16.0/Node.js Tools/Microsoft.NodejsToolsV2.targets" was not found. Confirm that the expression in the Import declaration "/usr/share/dotnet/sdk/3.1.201/Microsoft/VisualStudio/v16.0/Node.js Tools/Microsoft.NodejsToolsV2.targets" is correct, and that the file exists on disk.

这是有道理的,因为我们在任何时候都没有安装“NodeJS工具”,但我们找不到如何安装这些工具。如何使用dotnet cli安装NodeJS工具?

dotnetcli无法生成这些项目,因为这些项目所需的工具是Visual Studio的一部分,而不是.NET核心分发版或.NET Sdk支持的工作负载

虽然仍可以在.NET Core/Standard csproj文件上使用
dotnet
CLI,但不能在包含CLI不支持的项目的解决方案文件上使用它

但是,您可以在所有项目上使用Visual Studio安装中的
msbuild.exe
(建议使用VS Developer命令提示符),例如:


dotnet build foo.sln
=>
msbuild-restore foo.sln

我对这个问题的理解是,即使NodeJS项目不能使用.NET核心SDK构建(当然不能),但是
dotnet CLI
可能仍然能够安装
NodeJS
运行时,NodeJS运行时与作为visualstudio工作负载一部分的构建工具有所不同。这些基于MSBuild的目标不是NodeJ的一部分,目前不可用于.NET CLI。我指的是dotnet CLI,它可以用作工具管理器,并且独立于Visual Studio/MSBuild工作。然后,它只能作为其他工具/SDK的代表。例如,您可以运行
dotnet工具安装powershell
,然后使用
dotnet pwsh./yourscript.ps1
执行powershell脚本。不管您是否有.NET代码要构建,您仍然可以使用此技巧在任何地方运行Powershell。因此,如果NodeJS可以作为自定义.NET工具使用,那么它很可能就是OP正在寻找的。OP不是在寻找NodeJS本身,而是Visual Studio工作负载中名为“NodeJS工具”的MSBuild目标/任务部分。这些将需要成为CLI/SDK发行版本身的一部分(请参阅问题中的
SDK/3.1.201
文件夹),或者需要将其本身重新构造为MSBuild SDK,可以单独安装。您看过了吗?我可能看过,但我们只是在构建时忽略了节点项目,只是手动使用终端作为快速修复,从来没有真正回头看。我问这个是为了我们在夏天做的一个学校项目,我不再做了。谢谢你的帮助。