msbuild.exe 不在 Azure 中的 Linux VM 上 运行
msbuild.exe does not run on Linux VM in Azure
我正在尝试使用 Jenkins 运行 我的单元测试。我已经为构建步骤 "Build a Visual Studio Project using MSBuild" 构建了一个 Jenkins 项目。我的 Jenkins 服务器安装在 Azure 中的 linux 虚拟机上。
你可以在 Jenkins 中看到它 UI:
当我 运行 构建时,我得到这个控制台输出:
Path To MSBuild.exe: msbuild.exe
FATAL: Unable to use this plugin on this kind of operation system
Executing the command msbuild.exe /ContinuousIntegration/ContinuousIntegration.sln from
/var/lib/jenkins/workspace/CSHARP_CI_TEST - UNITTEST
[CSHARP_CI_TEST - UNITTEST] $ msbuild.exe
/ContinuousIntegration/ContinuousIntegration.sln
Build step 'Build a Visual Studio project or solution using MSBuild' changed
build result to FAILURE
Build step 'Build a Visual Studio project or solution using MSBuild' marked
build as failure
Finished: FAILURE
我认为这里的问题是我试图在 Linux VM 上使用 msbuild.exe。是否有解决此问题的方法或无法执行此操作?
我曾尝试通过 linux 终端在虚拟机上使用 msbuild.exe,但无法 运行 它。
要完成您的要求,您必须在 Azure Jenkins Linux VM 中安装“.NET Core SDK”,然后您可以简单地使用 'Execute shell' 构建步骤和命令 'dotnet build ContinuousIntegration/ContinuousIntegration.sln'
要在您的 Azure Jenkins Linux VM 中安装“.NET Core SDK”,请转到 https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install 并单击该页面中的 'Linux',然后单击 select所需的 Linux 分发并按照提供的步骤进行操作。
有关各种操作系统对 MSBuild 支持的更多信息,请参阅 https://github.com/Microsoft/msbuild/blob/master/documentation/wiki/Building-Testing-and-Debugging-on-.Net-Core-MSBuild.md
仅供参考,我已经测试并重现了您的场景并遇到了您提到的相同错误,然后我按照上述过程成功解决了问题。所以我希望这会有所帮助。干杯!!
PS:在您的 shell 脚本中,您必须 cd 到正确的文件夹才能工作。
我正在尝试使用 Jenkins 运行 我的单元测试。我已经为构建步骤 "Build a Visual Studio Project using MSBuild" 构建了一个 Jenkins 项目。我的 Jenkins 服务器安装在 Azure 中的 linux 虚拟机上。
你可以在 Jenkins 中看到它 UI:
当我 运行 构建时,我得到这个控制台输出:
Path To MSBuild.exe: msbuild.exe
FATAL: Unable to use this plugin on this kind of operation system
Executing the command msbuild.exe /ContinuousIntegration/ContinuousIntegration.sln from
/var/lib/jenkins/workspace/CSHARP_CI_TEST - UNITTEST
[CSHARP_CI_TEST - UNITTEST] $ msbuild.exe
/ContinuousIntegration/ContinuousIntegration.sln
Build step 'Build a Visual Studio project or solution using MSBuild' changed
build result to FAILURE
Build step 'Build a Visual Studio project or solution using MSBuild' marked
build as failure
Finished: FAILURE
我认为这里的问题是我试图在 Linux VM 上使用 msbuild.exe。是否有解决此问题的方法或无法执行此操作?
我曾尝试通过 linux 终端在虚拟机上使用 msbuild.exe,但无法 运行 它。
要完成您的要求,您必须在 Azure Jenkins Linux VM 中安装“.NET Core SDK”,然后您可以简单地使用 'Execute shell' 构建步骤和命令 'dotnet build ContinuousIntegration/ContinuousIntegration.sln'
要在您的 Azure Jenkins Linux VM 中安装“.NET Core SDK”,请转到 https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install 并单击该页面中的 'Linux',然后单击 select所需的 Linux 分发并按照提供的步骤进行操作。
有关各种操作系统对 MSBuild 支持的更多信息,请参阅 https://github.com/Microsoft/msbuild/blob/master/documentation/wiki/Building-Testing-and-Debugging-on-.Net-Core-MSBuild.md
仅供参考,我已经测试并重现了您的场景并遇到了您提到的相同错误,然后我按照上述过程成功解决了问题。所以我希望这会有所帮助。干杯!!
PS:在您的 shell 脚本中,您必须 cd 到正确的文件夹才能工作。