I am trying to replicate the exact functionality of this dialogue in Visual Studio 2008 in a build script:
This is an ASP.NET web site, not a web application.
I have Googled around this and turned up quite a bit of stuff involving MSBuild, but this all seems to concern solutions laid out as ASP.NET Web Applications:
http://www.driebier.net/post/Using-MSBuild-to-deploy-visual-studio-2005-web-applications.aspx
http://blog.donnfelker.com/post/TFS-Build-Not-Publishing-Web-Applications.aspx
This article seems to be relevant to ASP.NET Web Sites, but I find that I'm getting an error when trying to build using those suggestions:
C:\dev\T&A>msbuild /t:_CopyWebApplication /property:OutDir=c:\temp\taweb\ /prope rty:WebProjectOutputDir=c:\temp\taweb\ Microsoft (R) Build Engine Version 3.5.30729.1 [Microsoft .NET Framework, Version 2.0.50727.3074] Copyright (C) Microsoft Corporation 2007. All rights reserved. Build started 22/04/2009 11:50:42. Project "C:\dev\T&A\TAWeb.sln" on node 0 (_CopyWebApplication target(s)). Building solution configuration "Debug|.NET". C:\dev\T&A\TAWeb.sln : error MSB4057: The target "_CopyWebApplication" does not exist in the project. Done Building Project "C:\dev\T&A\TAWeb.sln" (_CopyWebApplication target(s)) -- FAILED. Build FAILED. "C:\dev\T&A\TAWeb.sln" (_CopyWebApplication target) (1) -> C:\dev\T&A\TAWeb.sln : error MSB4057: The target "_CopyWebApplication" does n ot exist in the project. 0 Warning(s) 1 Error(s) Time Elapsed 00:00:00.06
The solution I'm trying to publish (inherited, not my own) doesn't have .csproj files (where I could import the _CopyWebApplication target from C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets)
Perhaps this is a Visual Studio 2005/2008 difference?
Anyway, I feel that I'm going down the wrong path there.
Essentially I just need to achieve exactly what the above dialogue does, but from the command line.
Thanks very much
Best Answer
The following command duplicates the Publish Web Site dialog with default settings.
Command for Publish Web Site with Default Settings
aspnet_compiler -nologo -v / -p "C:\WebSite1" -u "C:\TargetPath"
Reference
1) See Community Content titled You want Publish a site but you have not Visual Studio then... at http://msdn.microsoft.com/en-us/library/20yh9f1b(classic).aspx.
2) See "ASP.NET Compilation Tool (Aspnet_compiler.exe)" at http://msdn.microsoft.com/en-us/library/ms229863.aspx.
3) Following excerpt from Walkthrough: Deploying an ASP.NET Web Application Using XCOPY at http://msdn.microsoft.com/en-us/library/f735abw9.aspx
4) Following excerpt from How to: Precompile ASP.NET Web Sites for Deployment at http://msdn.microsoft.com/en-us/library/ms227976.aspx.