Publish ASP.Net Web App or Website From Command Window

RUN->CMD->

1)%windir%\Microsoft.NET\Framework\v4.0.30319

2)C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_compiler -p F:\TestApp  -v
/ F:\Publish\Test


eg:

1)C:\Documents and Settings\pravin>cd %windir%\Microsoft.NET\Framework\v4.0.30319

2)C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_compiler -p F:\TestApp  -v
/ F:\Publish\Test
Utility to precompile an ASP.NET application
Copyright (C) Microsoft Corporation. All rights reserved.


To precompile an ASP.NET Web site for deployment

  1. Open a command window and navigate to the folder containing the .NET Framework.
    The .NET Framework is installed in the following location.
    %windir%\Microsoft.NET\Framework\version
    
  2. Run the aspnet_compiler command by typing the following at a command prompt, specifying the source as either a virtual path or physical path and the target folder for the compiled Web site.
    aspnet_compiler -v virtualPath targetPath
    
    If your Web site is not an Internet Information Services (IIS) application and therefore has no entry in the IIS metabase, used the following value for the -v switch.
    aspnet_compiler -p physicalOrRelativePath -v / targetPath
    
    In this case, the physicalOrRelativePath parameter refers to the fully qualified directory path in which the Web site files are located, or a path relative to the current directory. The period (.) operator is allowed in thephysicalOrRelativePath parameter. The -v switch specifies a root that the compiler will use to resolve application-root references (for example, with the tilde (~) operator). When you specify the value of / for the -vswitch the compiler will resolve the paths using the physical path as the root.
    The targetPath parameter is a physical path to the destination directory

To precompile an ASP.NET Web site for deployment and update

  1. Open a command window and navigate to the folder containing the .NET Framework.
    The .NET Framework is installed in the following location.
    %windir%\Microsoft.NET\Framework\version
    
  2. Run the aspnet_compiler command by typing the following at a command prompt, specifying the source as either a virtual path or physical path, the target folder for the compiled Web site, and the -u switch indicating you want to compile the site for deployment and update.
    aspnet_compiler -p physicalOrRelativePath -v / targetPath -u
Get Full Documentation from here.
Download the PDF from here.