3

我有一个构建 asp.net 应用程序的 msbuild 任务

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

当我尝试从构建代理的文件夹运行 rake 脚本时,构建脚本成功完成。我唯一的想法是 msbuild 输出此警告:

C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets:警告 MSB3247:发现同一依赖程序集的不同版本之间存在冲突。

4

2 回答 2

3

事实证明,我需要说明解决方案的完整路径

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
于 2010-07-07T10:48:02.347 回答
1

您可以将其添加到 msbuild 以获得正确的 msbuild 输出:

/l:JetBrains.BuildServer.MSBuildLoggers.MSBuildLogger,D:/teamcity/buildagent/plugins/dotnetplugin/bin/JetBrains.BuildServer.MSBuildLoggers.dll

编辑:用长鳍金枪鱼说话:

msb.parameters "/l:JetBrains.BuildServer.MSBuildLoggers.MSBuildLogger,D:/teamcity/buildagent/plugins/dotnetplugin/bin/JetBrains.BuildServer.MSBuildLoggers.dll"

(显然将其设置为您的 TC 路径)

编辑 2: MSBuild 错误听起来像是您引用了不同版本的事物。你有强命名的引用吗?您是否让 resharper 添加了您的参考资料?有时它会将它们混合在一起,添加对其他项目的 bin 文件夹而不是您的 lib 的引用。

于 2010-07-06T17:31:04.950 回答