问题
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?
回答1:
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
My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build
回答2:
In your MSBuild arguments use the OutDir option to set an output directory. You then get the following:
- All the DLLs in your project.
- 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.
回答3:
devenv.exe /rebuild debug mywebsite.sln
I found I had to use debug rather than release or the build was skipped.
来源:https://stackoverflow.com/questions/1147437/how-to-build-a-net-website-using-nant