【发布时间】:2019-12-24 17:25:36
【问题描述】:
我正在尝试在 Jenkins 中使用VS Build tools 2017 构建一个 dotnet 3.5 项目解决方案文件。该项目使用 DotNet 3.5 的 MSBuild 编译得很好,但是当我尝试使用 MSBuild Engine Version 15.9.21+g9802d43bc3 进行相同的活动时,它正在抛出 MSBUILD : error MSB4025: The project file could not be loaded. Root element is missing。
这是我用来编译 dotnet 3.5 项目的命令。
cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
MSBuild.exe "%WORKSPACE%\WBR.sln" /p:Configuration=Debug /p:DeployOnBuild=True /p:AllowUntrustedCertificate=True /p:CreatePackageOnPublish=True
请在下面找到 Jenkins 执行日志
C:\Users\Netadmin\.jenkins\jobs\FCRS\jobs\FCRS_VS\workspace>cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin>MSBuild.exe "C:\Users\Netadmin\.jenkins\jobs\FCRS\jobs\FCRS_VS\workspace\WBR.sln" /p:Configuration=Debug /p:DeployOnBuild=True /p:AllowUntrustedCertificate=True /p:CreatePackageOnPublish=True
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 8/19/2019 6:38:12 PM.
MSBUILD : error MSB4025: The project file could not be loaded. Root element is missing.
Build FAILED.
MSBUILD : error MSB4025: The project file could not be loaded. Root element is missing.
0 Warning(s)
1 Error(s)
下图是我的詹金斯工作区目录。
任何帮助都会很棒。
【问题讨论】:
-
看起来这个项目必须从 vs2010 迁移到 vs17 如果这必须工作。如果有人能证实这一点,那就太好了。
-
据我所知,有几种可能会导致这种错误。但现在我无法确定它属于哪种情况。您可以尝试使用较旧的 msbuild 版本,路径为:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe,或者您可以在配置构建工具包时检查是否安装了相应的 C# 工作负载。 -
嗨@LanceLi-MSFT。如问题中所述,3.5 的 msbuild 成功编译代码,但 vs17 的 msbuild 因上述错误而失败。注意:这是一个 3.5 项目。你能告诉我哪些工作负载适合这种情况吗?我会检查它们是否存在于我的系统中。
-
昨天还没来得及测试build tools 2017能否很好的构建.net 3.5项目,今天测试后,我认为在正常情况下(典型的.net控制台、wpf、web应用) ,无需迁移它们。由于您尝试在命令行中构建它们而不是通过 vs 加载它们。
-
但我正在从命令行使用 vs17 的构建工具。 @LanceLi-MSFT
标签: visual-studio msbuild jenkins-pipeline .net-3.5 visual-studio-2017-build-tools