简体   繁体   English

Bamboo随机运行不同版本的msbuild.exe并生成失败

[英]Bamboo randomly runs different version of msbuild.exe and build fails

I use Bamboo to build my SSDT database solution using VS2012. 我使用Bamboo通过VS2012构建我的SSDT数据库解决方案。 The problem began when I added database unit test project to the solution. 当我将数据库单元测试项目添加到解决方案中时,问题就开始了。 It is random that sometimes build fails with message: 有时构建失败并显示以下消息是随机的:

error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) 错误CS0234:类型或名称空间名称“ VisualStudio”在名称空间“ Microsoft”中不存在(您是否缺少程序集引用?)

Bamboo always runs msbuilds from this location: C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\MSBuild.exe Bamboo始终从以下位置运行msbuild:C:\\ Windows \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ MSBuild.exe

I noticed that whenever build fails the msbuild.exe output is this: 我注意到, 只要构建失败 ,msbuild.exe的输出就是这样的:

Microsoft (R) Build Engine version 4.0.30319.18408 Microsoft(R)Build Engine版本4.0.30319.18408

[Microsoft .NET Framework, version 4.0.30319.18449] [Microsoft .NET Framework版本4.0.30319.18449]

but when build succeed then output is this: 但是当构建成功时,输出是这样的:

Microsoft (R) Build Engine version 4.0.30319.34209 Microsoft(R)Build Engine版本4.0.30319.34209

[Microsoft .NET Framework, version 4.0.30319.34209] [Microsoft .NET Framework版本4.0.30319.34209]

I don't know where is it taking version 4.0.30319.18408 from. 我不知道从哪里获取4.0.30319.18408版本。 I searched whole disk for msbuild.exe and executed everyone and none of them has version 4.0.30319.18408. 我在整个磁盘上搜索了msbuild.exe并执行了所有人,但没有一个版本为4.0.30319.18408。

I need an advice how to force Bamboo to run correct version of msbuild.exe or how to uninstall version 4.0.30319.18408. 我需要有关如何强制Bamboo运行正确版本的msbuild.exe或如何卸载4.0.30319.18408的建议。

Components on the build machine are following: 构建机器上的组件如下:

Microsoft .NET Framework 4 Multi-Targeting Pack                        4.0.30319  
Microsoft .NET Framework 4.5 Multi-Targeting Pack                      4.5.50709  
Microsoft .NET Framework 4.5 SDK                                       4.5.50710  
Microsoft .NET Framework 4.5.2 Multi-Targeting Pack                    4.5.51651  
Microsoft .NET Framework 4.5.2 Multi-Targeting Pack (ENU)              4.5.51209  
Microsoft Visual Studio 2010 Shell (Integrated) - ENU                  10.0.40219  
Microsoft Visual Studio 2010 Shell (Isolated) - ENU                    10.0.40219  
Microsoft Visual Studio 2012 Devenv                                    11.0.50727  
Microsoft Visual Studio 2012 Devenv Resources                          11.0.50727  
Microsoft Visual Studio 2012 Performance Collection Tools              11.0.50727  
Microsoft Visual Studio 2012 Performance Collection Tools - ENU        11.0.50727  
Microsoft Visual Studio 2012 Preparation                               11.0.50727  
Microsoft Visual Studio 2012 Shell (Minimum)                           11.0.50727  
Microsoft Visual Studio 2012 Shell (Minimum) Interop Assemblies        11.0.50727  
Microsoft Visual Studio 2012 Shell (Minimum) Resources                 11.0.50727  
Microsoft Visual Studio 2012 Tools for SQL Server Compact 4.0 SP1 ENU  4.0.8876.1  
Microsoft Visual Studio Professional 2012                              11.0.50727  
Microsoft Visual Studio Professional 2012 - ENU                        11.0.50727  
Microsoft SQL Server Data Tools – Database Projects – Web installer... 10.3.20116.0  
Microsoft SQL Server Data Tools - enu (11.1.50318.0)                   11.1.50318.0  
Microsoft SQL Server Data Tools Build Utilities - enu (11.1.40403.0)   11.1.40403.0  

There is no msbuild in the PATH. PATH中没有msbuild。

EDIT: Components list is scripted with PowerShell. 编辑:组件列表使用PowerShell编写脚本。 I just noticed that actual list in Programs and Features is shorter. 我只是注意到“程序和功能”中的实际列表较短。 There is only one Visual Studio 2012 Professional. 只有一个Visual Studio 2012 Professional。

I modified Bamboo task not to call msbuild executable but to run such script: 我修改了Bamboo任务以不调用msbuild可执行文件,而是运行以下脚本:

    ECHO Setting variables
    CALL "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\vsvars32.bat"

    ECHO Starting msbuild.exe
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe .\SVN_CHECKOUT\Databases\Databases.sln /fileLoggerParameters:LogFile=".\msbuild.log.txt" /p:Configuration=Release /consoleloggerparameters:ErrorsOnly;Verbosity=quiet;Summary /m

So far it works. 到目前为止,它仍然有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Dev和Jenkins机器之间使用不同版本的MSBUILD.exe - Using different version of MSBUILD.exe between Dev and Jenkins machine 发布后事件不与msbuild.exe一起使用 - Post build event not working with msbuild.exe 使用MSBuild.exe时相当于dotnet build --version-suffix - Equivalent of dotnet build --version-suffix when using MSBuild.exe 以编程方式发布版本(如ClickOnce),淘汰msbuild.exe - Publish version programatically (like ClickOnce) whitout msbuild.exe 在 Jenkins 中构建后无法识别 msbuild.exe 命令 - msbuild.exe is not recognized command after build in Jenkins Visual Studio SSDT 数据库项目 (.sqlproj) 构建 - 使用没有 MSBUILD (msbuild.exe) 的 CLI 生成.dacpac - Visual Studio SSDT Database project (.sqlproj) build - generate .dacpac using CLI without MSBUILD (msbuild.exe) Jenkins 无法识别 msbuild.exe - Jenkins doesn't recognize msbuild.exe 以编程方式使用msbuild.exe构建我的.NET解决方案并输出日志 - Build my .NET Solution using msbuild.exe programmatically and output the logs 正确的MSBuild.exe位置,以使用命令行构建.net 4.5应用程序 - Correct location of MSBuild.exe to build .net 4.5 application using command line VS2019 MSBuild.exe-使用PublishProfile时ASP .Net MVC项目无法发布,但使用OutDir参数时可以使用 - VS2019 MSBuild.exe - ASP .Net MVC project fails to publish when using PublishProfile, but works when using OutDir parameter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM