ResourcesGenerator 工作會將一或多個資源 (.jpg、.ico、.bmp、二進位格式的 XAML 以及其他副檔名類型) 內嵌至 .resources 檔案。
工作參數
| 參數 | 描述 |
|---|---|
OutputPath |
必要的 String 參數。 指定輸出目錄的路徑。 如果路徑不是絕對路徑,會將它視為相對於專案根目錄的路徑。 |
OutputResourcesFile |
必要的 ITaskItem[] 輸出參數。 指定所產生 .resources 檔案的路徑和名稱。 如果路徑不是絕對路徑,會相對於專案根目錄產生 .resources 檔案。 |
ResourcesFiles |
必要的 ITaskItem[] 參數。 指定要內嵌到所產生 .resources 檔案的一或多種資源。 |
範例
下列範例會使用單一 .bmp 資源產生 .resources 檔案。 在相對於專案根目錄的目錄中產生 .bmp 資源。
<Project>
<UsingTask
TaskName="Microsoft.Build.Tasks.Windows.ResourcesGenerator"
AssemblyFile="C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationBuildTasks.dll" />
<Target Name="ResourcesGeneratorTask">
<ResourcesGenerator
ResourceFiles="Resource1.bmp"
OutputPath="myresources"
OutputResourcesFile="myresources\my.resources" />
</Target>
</Project>