Tuesday, September 08, 2009

How To Publish an ASP.NET Website from a Command Line

Via: http://blogs.msdn.com/securitytools/archive/2009/09/08/how-to-publish-an-asp-net-website-from-a-command-line.aspx (by Syed Aslam Basha)

A batch script to publish an ASP.Net website from the command line – very useful.

@ECHO OFF
set WEB_ROOT=C:\inetpub\wwwroot\mytestsite
set PROJECT_ROOT=D:\Source\website 

echo Publishing site %PROJECT_ROOT% to %WEB_ROOT% 

del /S /Q %WEB_ROOT%\*.* || goto Error
rmdir /S /Q %WEB_ROOT%\ || goto Error
aspnet_compiler -p "%PROJECT_ROOT%" /v /commercesite /d "%WEB_ROOT%" || goto Error 
 
goto Success
:Error
echo Site was not published

goto End

:Success
echo Site published successfully

:End

1 comment:

  1. if i want to publish it to file system path then how to do it any idea

    ReplyDelete

Remember, if you want me to respond to your comment, then you need to use a Google/OpenID account to leave the comment.