Partager via


AspNetCompiler Task

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

The AspNetCompiler task wraps aspnet_compiler.exe, a utility to precompile ASP.NET applications.

Task Parameters

The following table describes the parameters of the AspNetCompiler task.

Parameter Description
AllowPartiallyTrustedCallers Optional Boolean parameter.

If this parameter is true,, the strong-name assembly will allow partially trusted callers.
Clean Optional Boolean parameter

If this parameter is true, the precompiled application will be built clean. Any previously compiled components will be recompiled. The default value is false. This parameter corresponds to the -c switch on aspnet_compiler.exe.
Debug Optional Boolean parameter.

If this parameter is true, debug information (.PDB file) is emitted during compilation. The default value is false. This parameter corresponds to the -d switch on aspnet_compiler.exe.
DelaySign Optional Boolean parameter.

If this parameter is true, the assembly is not fully signed when created.
FixedNames Optional Boolean parameter.

If this parameter is true, the compiled assemblies will be given fixed names..
Force Optional Boolean parameter

If this parameter is true, the task will overwrite the target directory if it already exists. Existing contents are lost. The default value is false. This parameter corresponds to the -f switch on aspnet_compiler.exe.
KeyContainer Optional String parameter.

Specifies a strong name key container.
KeyFile Optional String parameter.

Specifies the physical path to the strong name key file..
MetabasePath Optional String parameter.

Specifies the full IIS metabase path of the application. This parameter cannot be combined with the VirtualPath or PhysicalPath parameters. This parameter corresponds to the -m switch on aspnet_compiler.exe.
PhysicalPath Optional String parameter.

Specifies the physical path of the application to be compiled. If this parameter is missing, the IIS metabase is used to locate the application. This parameter corresponds to the -p switch on aspnet_compiler.exe.
TargetFrameworkMoniker Optional String parameter.

Specifies the TargetFrameworkMoniker indicating which .NET Framework version of aspnet_compiler.exe should be used. Only accepts .NET Framework monikers.
TargetPath Optional String parameter.

Specifies the physical path to which the application is compiled. If not specified, the application is precompiled in-place.
Updateable Optional Boolean parameter.

If this parameter is true, the precompiled application will be updateable. The default value is false. This parameter corresponds to the -u switch on aspnet_compiler.exe.
VirtualPath Optional String parameter.

The virtual path of the application to be compiled. If PhysicalPath specified, the physical path is used to locate the application. Otherwise, the IIS metabase is used, and the application is assumed to be in the default site. This parameter corresponds to the -v switch on aspnet_compiler.exe.

Remarks

In addition to the parameters listed above, this task inherits parameters from the ToolTaskExtension class, which itself inherits from the ToolTask class. For a list of these additional parameters and their descriptions, see ToolTaskExtension Base Class.

Example

The following code example uses the AspNetCompiler task to precompile an ASP.NET application.

<Project xmlns="https://schemas.microsoft.com/developer/msbuild/2003">  
    <Target Name="PrecompileWeb">  
        <AspNetCompiler  
            VirtualPath="/MyWebSite"  
            PhysicalPath="c:\inetpub\wwwroot\MyWebSite\"  
            TargetPath="c:\precompiledweb\MyWebSite\"  
            Force="true"  
            Debug="true"  
        />  
    </Target>  
</Project>  

See Also

Tasks
Task Reference