Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I build a .NET web application project using Albacore's msbuild task?

I have a solution with a web application project (WAP), which builds and packages in Visual Studio. But, when I run this Albacore msbuild task, it doesn't work.

msbuild :build do |msb| 
  msb.solution = '../../src/Solution.sln'
  msb.targets :clean, :build, :Package
  msb.properties = { 
    :configuration => :Dev
  } 
end

I get this error

The target "Package" does not exist in the project ....Solution.sln

How do I build a WAP and make a package using Albacore and rake?

Update: working task

msbuild :build do |msb| 
  msb.solution = '../../src/Solution.sln'
  msb.targets :clean, :build
  msb.parameters = '/p:DeployOnBuild=true;DeployTarget=Package'
  msb.properties = { 
    :configuration => :Dev
  } 
end 
like image 233
Rob Avatar asked Dec 09 '10 17:12

Rob


1 Answers

When you build a solution file you can only use the following targets.

  • Build
  • Rebuild
  • Clean
  • Publish

If you are trying to invoke the Package target on a Web Application Project (WAP) then, you can use the following syntax to call it for every WAP in that solution.

msbuild YourSolution.sln /p:DeployOnBuild=true;DeployTarget=Package

WAP projects have a special hook to invoke any target during a build. That is enabled by the when the property DeployOnBuild=true and the target that is invoked is defined by the DeployTarget property.

I'm not sure what the Rake syntax is for that, but if you could post it here for others that would be ideal.

like image 76
Sayed Ibrahim Hashimi Avatar answered Sep 21 '22 22:09

Sayed Ibrahim Hashimi