为什么这个 Albacore msbuild 任务在 TeamCity 中失败?
我有一个 msbuild 任务,它构建一个 asp.net 应用程序,
msbuild :build do |msb|
puts "Running local build"
msb.properties :configuration => :Release, :outdir => File.dirname(__FILE__) + "/output/"
msb.targets :Build
msb.solution = 'App.sln'
msb.verbosity = 'quiet'
end
在本地运行它工作得很好,但是当 Teamcity(5.1.2,构建 13430)尝试构建它时,它失败并出现以下错误:
[18:13:04]: C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/albacore/support/attrmethods.rb:7: warning: parenthesize argument(s) for future version
[18:13:04]: C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/albacore/support/attrmethods.rb:7: warning: parenthesize argument(s) for future version
[18:13:05]: Execute build
[18:13:05]: [Execute build]
RuntimeError: MSBuild Failed. See Build Log For Detail
Stacktrace:
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/albacore/support/failure.rb:12:in `fail_with_message'
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/albacore/msbuild.rb:41:in `build_solution'
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/albacore/msbuild.rb:26:in `build'
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/rake/msbuildtask.rb:2
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/rake/support/createtask.rb:17:in `call'
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/rake/support/createtask.rb:17:in `execute'
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/rake/support/albacoretask.rb:16:in `define'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `standard_execute'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `standard_execute'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:260:in `execute'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:266:in `execute'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
C:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
C:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
C:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `standard_invoke_with_call_chain'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:235:in `invoke'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:234:in `invoke'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:311:in `standard_exception_handling'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:311:in `standard_exception_handling'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:179:in `run'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rakerunner.rb:40
当我尝试从构建代理的文件夹构建脚本成功完成。我唯一的想法是 msbuild 输出此警告:
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets:警告 MSB3247:发现同一依赖程序集的不同版本之间存在冲突。
I have an msbuild task which builds an asp.net application
msbuild :build do |msb|
puts "Running local build"
msb.properties :configuration => :Release, :outdir => File.dirname(__FILE__) + "/output/"
msb.targets :Build
msb.solution = 'App.sln'
msb.verbosity = 'quiet'
end
Running this locally works perfectly fine however when Teamcity (5.1.2, build 13430) try's to build it, it fails with the following error:
[18:13:04]: C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/albacore/support/attrmethods.rb:7: warning: parenthesize argument(s) for future version
[18:13:04]: C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/albacore/support/attrmethods.rb:7: warning: parenthesize argument(s) for future version
[18:13:05]: Execute build
[18:13:05]: [Execute build]
RuntimeError: MSBuild Failed. See Build Log For Detail
Stacktrace:
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/albacore/support/failure.rb:12:in `fail_with_message'
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/albacore/msbuild.rb:41:in `build_solution'
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/albacore/msbuild.rb:26:in `build'
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/rake/msbuildtask.rb:2
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/rake/support/createtask.rb:17:in `call'
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/rake/support/createtask.rb:17:in `execute'
C:/ruby/lib/ruby/gems/1.8/gems/albacore-0.1.5/lib/rake/support/albacoretask.rb:16:in `define'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `standard_execute'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `standard_execute'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:260:in `execute'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:266:in `execute'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
C:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
C:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
C:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `standard_invoke_with_call_chain'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:235:in `invoke'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:234:in `invoke'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:311:in `standard_exception_handling'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:311:in `standard_exception_handling'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:179:in `run'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rakerunner.rb:40
When I try running the rake script from the build agent's folder the build script completes successfully. The only thought I have is that msbuild outputs this warning:
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning MSB3247: Found conflicts between different versions of the same dependent assembly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明,我需要说明解决方案的完整路径
Turns out, I needed to state the full path to the solution
您可以将其添加到 msbuild 中以获得正确的 msbuild 输出:
编辑:用 albacore-speak:(
显然将其设置为您的 TC 路径)
编辑 2:MSBuild 错误听起来像是您正在引用不同版本的东西。你有强命名的参考文献吗?你让 resharper 添加你的参考文献了吗?有时它会将它们混合在一起,添加对其他项目的 bin 文件夹而不是您的 lib 的引用。
you can add this to msbuild to get the proper msbuild output:
Edit: In albacore-speak:
(set it to your TC path obviously)
Edit 2: The MSBuild error sounds like you're referencing different version of things. have you got strongly named references? Did you let resharper add your references? sometimes it mixes them up, adding references to other project's bin folders instead of your lib.