如何使用 dotnet cli 安装 'Node JS Tools'
How to install 'Node JS Tools' with dotnet cli
我们正在构建一个 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 Tools',但我们找不到如何安装这些工具。如何使用 dotnet cli 安装 NodeJS 工具?
dotnet
CLI 无法构建这些项目,因为这些项目所需的工具是 Visual Studio 的一部分,而不是 .NET Core 发行版或 .NET Sdk 支持的工作负载。
虽然您仍然可以在 .NET Core/Standard csproj 文件上使用 dotnet
CLI,但您不能在包含 CLI 不支持的项目的解决方案文件上使用它。
但是,您可以在所有项目上使用 Visual Studio 安装中的 msbuild.exe
(建议使用 VS 开发人员命令提示符),例如:
dotnet build foo.sln
=> msbuild -restore foo.sln
我们正在构建一个 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 Tools',但我们找不到如何安装这些工具。如何使用 dotnet cli 安装 NodeJS 工具?
dotnet
CLI 无法构建这些项目,因为这些项目所需的工具是 Visual Studio 的一部分,而不是 .NET Core 发行版或 .NET Sdk 支持的工作负载。
虽然您仍然可以在 .NET Core/Standard csproj 文件上使用 dotnet
CLI,但您不能在包含 CLI 不支持的项目的解决方案文件上使用它。
但是,您可以在所有项目上使用 Visual Studio 安装中的 msbuild.exe
(建议使用 VS 开发人员命令提示符),例如:
dotnet build foo.sln
=> msbuild -restore foo.sln