Share via


Como: Pré-compila sites da Web do ASP.NET para implantação

When you precompile an ASP.NET Web site for deployment you create a layout containing assemblies and other information that you can then copy to a production server.A Web site that is precompiled for deployment gives you the ability to create a compiled version of the site that can be deployed to a production server without source code.

You can choose to precompile either code and .aspx pages, or just the code.If you precompile only the code, you can update the user interface of the site without having to recompile the entire site.

The procedures in this topic use the switches and parameters of the ASP.NET Compilation Tool (Aspnet_compiler.exe).For more information about this tool, see ASP.NET Compilation Tool (Aspnet_compiler.exe).

Para mais informações sobre pré-compilação, consulte Precompilação de Site da Web ASP.NET.

To precompile an ASP.NET Web site for deployment

  1. Abra uma janela de comando e navegue para a pasta que contém o .NET Framework.

    O .NET Framework é instalado na localidade a seguir.

    %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 virtualPathtargetPath
    

    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
    

    Neste caso, o parâmetro physicalOrRelativePath se refere ao caminho totalmente qualificado do diretório no qual os arquivos do site da Web estão localizados, ou um caminho relativo para o diretório atual.O operador de período (.) é permitido no parâmetro physicalOrRelativePath.A opção -v especifica uma raiz que o compilador usará para resolver referências da raiz do aplicativo (por exemplo, com o operador til (~)).When you specify the value of / for the -v switch 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. Abra uma janela de comando e navegue para a pasta que contém o .NET Framework.

    O .NET Framework é instalado na localidade a seguir.

    %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
    

Consulte também

Tarefas

Como: Precompile ASP.NET Web Sites

Outros recursos

Precompilação de Site da Web ASP.NET