views:

573

answers:

3

I usually use web applications in Visual Studio and the MSBUILD taks in Nant builds them without any problems:

<msbuild project="MySolution.sln">
  arg value="/property:Configuration=release" />
</msbuild>

I now have a website (not a web application) in a VS Solution and it won't build - I get a lot of namespace errors.

Should I be able to build the solution with MSBUILD even though it contains a website? Or do I need to use CSC?

+2  A: 

You should try using the devenv.exe command if msbuild.exe is failing for you. Also you may be interested in Web Deployment Projects.

Sayed Ibrahim Hashimi
+1  A: 

In your MSBuild arguments use the OutDir option to set an output directory. You then get the following:

  1. All the DLLs in your project.
  2. A directory called _PublishedWebsite. This gives you the same output a Publish command in Visual Studio.

This is what we do to build our web apps through MSBuild.

spooner
+1  A: 
devenv.exe /rebuild debug mywebsite.sln

I found I had to use debug rather than release or the build was skipped.

thelsdj