views:

105

answers:

1

I got test server which I would like to use for CI too.

Plan is to setup Hudson that listens to git repository, on new commit fetches changes, builds solution, runs tests (picks up output), setups test environment web application if everything looks green and shows Chuck Norris.

I'm struggling with first part (git ports are closed atm but that's not the point of this question) and last part.

Application itself is built using .Net 4.0, Asp.Net Mvc 2 RTM and bunch of 3rd party tools.

At first - couldn't build anything at all - downloaded .Net 4.0 sdk kit and it helped. Then - could not build web project - just copied C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\ folder contents from my dev workstation to server. Then I had to install asp.net mvc2 rtm itself and solution finally was building successfully.

Problem is with last step in albacore build script which i took from here.

Here's output:

C:\temp\buildtest>rake -f build.rb (in C:/temp/buildtest) Microsoft (R) Build Engine Version 4.0.30319.1 [Microsoft .NET Framework, Version 4.0.30319.1] Copyright (C) Microsoft Corporation 2007. All rights reserved.

Domain -> C:\temp\buildtest\src\Domain\bin\Release\Domain.dll
Infra -> C:\temp\buildtest\src\Infrastructure\bin\Release\Infra.dll
Persistence -> C:\temp\buildtest\src\Persistence\bin\Release\Persistence.dll
App -> C:\temp\buildtest\src\App\bin\Release\App.dll
Web -> C:\temp\buildtest\src\Web\bin\Release\Web.dll
UI -> C:\temp\buildtest\src\UI\bin\UI.dll
Unit -> C:\temp\buildtest\src\UnitTests\bin\Release\Unit.dll
Integration -> C:\temp\buildtest\src\Integration\bin\Release\Integration.dll
xUnit.net console test runner (32-bit .NET 4.0.30319.1)
Copyright (C) 2007-10 Microsoft Corporation.

xunit.dll: Version 1.6.1.1521
Test assembly: C:\temp\buildtest\src\UnitTests\bin\Release\src\UnitTests\bin\Release\Unit.dll

84 total, 0 failed, 0 skipped, took 9.560 seconds
xUnit.net console test runner (32-bit .NET 4.0.30319.1)
Copyright (C) 2007-10 Microsoft Corporation.

xunit.dll: Version 1.6.1.1521
Test assembly: C:\temp\buildtest\src\Integration\bin\Release\src\Integration\bin \Release\Integration.dll

27 total, 0 failed, 0 skipped, took 34.472 seconds

Unhandled Exception: System.TypeInitializationException: The type initializer fo r 'Microsoft.Build.CommandLine.MSBuildApp' threw an exception. ---> System.IO.Fi leNotFoundException: Could not load file or assembly 'Microsoft.Build.Engine, Ve rsion=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its d ependencies. The system cannot find the file specified. File name: 'Microsoft.Build.Engine, Version=3.5.0.0, Culture=neutral, PublicKeyT oken=b03f5f7f11d50a3a' at Microsoft.Build.CommandLine.MSBuildApp..cctor()

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\M icrosoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure lo gging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus ion!EnableLog].

--- End of inner exception stack trace --- at Microsoft.Build.CommandLine.MSBuildApp.Main() F, [2010-09-18T00:35:07.728632 #2072] FATAL -- : MSBuild Failed. See Build Log F or Detail rake aborted! MSBuild Failed. See Build Log For Detail C:/Ruby191/lib/ruby/gems/1.9.1/gems/albacore-0.1.5/lib/albacore/msbuild.rb:41:in `build_solution' (See full trace by running task with --trace)

C:\temp\buildtest>

This is how my albacore script looks like:

require 'rubygems'
require 'albacore'
task :default => :publish

desc "Builds Interreg solution"
msbuild :build do |m|
  m.path_to_command = File.join(ENV["windir"], 
    "Microsoft.NET", "Framework", "v4.0.30319", "MSBuild.exe")
  m.properties :configuration => :Release
  m.targets :Clean, :Build
  m.solution = "Interreg.sln"
  m.verbosity = "minimal"
end

desc "Runs some tests"
xunit :tests => :build do |x|
  x.path_to_command = "lib/xunitnet/xunit.console.clr4.x86.exe"
  x.assemblies "src/UnitTests/bin/Release/Unit.dll",
    "src/Integration/bin/Release/Integration.dll"
  x.html_output = "doc"
end

desc "Publishes web application"
msbuild :publish=>:tests do |m|
  m.properties={:configuration=>:Release}
  m.targets [:ResolveReferences, :_CopyWebApplication]
  m.properties={
   :webprojectoutputdire=>"c:/temp/outputdir/",
   :outdir=>"c:/temp/outputdir/bin/"
  }
  m.solution="src/UI/UI.csproj"
end

So... What is missing? How to make it work?

How to package asp.net web application w/o visual studio?

+1  A: 

Install the Windows 7 SDK on your CI server, which includes everything you need to build .NET 4 applications on your CI server. This will take care of all the dependencies that you need in the GAC, and prevent you from having to manually copy a bunch of files from your development workstation.

http://msdn.microsoft.com/en-us/windows/bb980924.aspx

Derick Bailey
I installed it. While that makes it to build successfully, unfortunately - `:_CopyWebApplication` target still fails. Was it supposed to work too?
Arnis L.
@Amis: CopyWebApplication is a Visual Studio function. You might be able to copy it (MSBuild target) from a Dev machine, but why don't you just install VS or WebDeveloper on the machine?
Henk Holterman
@Henk I think this is what I'm going to do after all.
Arnis L.
Actually - there is no need for packaging. It's enough to build and copy directory. Ty Derick for quite nice tool.
Arnis L.