AspNetCompiler TaskĀ 

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

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.

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.

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.

TargetPath

Optional String parameter.

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

Timeout

Optional Int32 parameter.

Specifies the amount of time, in milliseconds, after which the task executable is terminated. The default value is Int.MaxValue, indicating that there is no time out period.

ToolPath

Optional String parameter.

Specifies the location from where the task will load the underlying executable file (aspnet_compiler.exe). If this parameter is not specified, the task uses the SDK installation path corresponding to the version of the framework that is running MSBuild.

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

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

Concepts

MSBuild Tasks

Other Resources

MSBuild Task Reference