Why does this Albacore msbuild task fail in TeamCity?
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:/rub开发者_如何学Cy/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.
Turns out, I needed to state the full path to the solution
root_path = File.dirname(__FILE__)
msbuild :build do |msb|
puts "Running local build"
msb.properties :configuration => :Release, :outdir => File.dirname(__FILE__) + "/output/"
msb.targets :Build
msb.solution = File.join(root_path, 'App.sln')
msb.verbosity = 'quiet'
end
you can add this to msbuild to get the proper msbuild output:
/l:JetBrains.BuildServer.MSBuildLoggers.MSBuildLogger,D:/teamcity/buildagent/plugins/dotnetplugin/bin/JetBrains.BuildServer.MSBuildLoggers.dll
Edit: In albacore-speak:
msb.parameters "/l:JetBrains.BuildServer.MSBuildLoggers.MSBuildLogger,D:/teamcity/buildagent/plugins/dotnetplugin/bin/JetBrains.BuildServer.MSBuildLoggers.dll"
(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.
精彩评论