共用方式為


AspNetCompiler 工作

更新:2007 年 11 月

AspNetCompiler 工作包裝 aspnet_compiler.exe,這是先行編譯 ASP.NET 應用程式的公用程式。

工作參數

下表說明 AspNetCompiler 工作的參數。

參數

描述

Clean

選擇性 (Optional) Boolean 參數。

如果此參數為 true,先行編譯的應用程式就會進行清除建置。之前編譯過的任何元件都會重新編譯。預設值為 false。這個參數對應於 aspnet_compiler.exe 上的 -c 選項。

Debug

選擇性 Boolean 參數。

如果這個參數為 true,在編譯 (Compilation) 期間便會發出偵錯資訊 (.PDB 檔)。預設值為 false。這個參數對應於 aspnet_compiler.exe 上的 -d 選項。

Force

選擇性 Boolean 參數。

如果這個參數為 true,工作便會覆寫目標 (Target) 目錄 (如果已經存在)。現有的內容都會遺失。預設值為 false。這個參數對應於 aspnet_compiler.exe 上的 -f 選項。

MetabasePath

選擇性 String 參數。

指定應用程式的完整 IIS Metabase 路徑。這個參數無法與 VirtualPathPhysicalPath 參數合併。這個參數對應於 aspnet_compiler.exe 上的 -m 選項。

PhysicalPath

選擇性 String 參數。

指定要編譯之應用程式的實體路徑。如果遺失此參數,便會使用 IIS Metabase 來找出應用程式。這個參數對應於 aspnet_compiler.exe 上的 -p 選項。

TargetPath

選擇性 String 參數。

指定要將應用程式編譯至的實體路徑。如果沒有指定,應用程式便會就地先行編譯。

Timeout

選擇性 Int32 參數。

指定以毫秒為單位的時間長度,這段時間過後即結束工作可執行檔。預設值為 Int.MaxValue,表示沒有逾時時間。

ToolPath

選擇性 String 參數。

指定工作將會載入基礎可執行檔 (aspnet_compiler.exe) 的位置。如果未指定此參數,工作會使用對應於執行 MSBuild 之架構版本的 SDK 安裝路徑。

Updateable

選擇性 Boolean 參數。

如果此參數為 true,先行編譯的應用程式就會是可更新的。預設值為 false。這個參數對應於 aspnet_compiler.exe 上的 -u 選項。

VirtualPath

選擇性 String 參數。

所要編譯之應用程式的虛擬路徑。如果有指定 PhysicalPath,就會使用實體路徑來找出應用程式。否則,便會使用 IIS Metabase,並假設應用程式位於預設網站。這個參數對應於 aspnet_compiler.exe 上的 -v 選項。

範例

在下列程式碼範例中,使用 AspNetCompiler 工作來先行編譯 ASP.NET 應用程式。

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

請參閱

概念

MSBuild 工作

其他資源

MSBuild 工作參考