Windows 執行時間元數據匯出工具 (Winmdexp.exe) 會將 .NET Framework 模組轉換成包含 Windows 運行時間元數據的檔案。 雖然 .NET Framework 元件和 Windows 運行時間元數據檔案使用相同的實體格式,但元數據表的內容有差異,這表示 .NET Framework 元件不會自動作為 Windows 運行時間元件使用。 將 .NET Framework 模組轉換成 Windows 執行時間元件的程式稱為 匯出。 在 .NET Framework 4.5 和 4.5.1 中,產生的 Windows 元數據 (.winmd) 檔案同時包含元數據和實作。
當您在 Visual Studio 2013 或 Visual Studio 2012 中使用 Windows 市集 for C# 和 Visual Basic 下的 Windows 運行時間元件範本時,編譯程式目標是 .winmdobj 檔案,而後續建置步驟會呼叫 Winmdexp.exe,將 .winmdobj 檔案導出至 .winmd 檔案。 這是建置 Windows 執行時間元件的建議方式。 當您想要比 Visual Studio 提供更多的建置程式控制權時,直接使用 Winmdexp.exe。
此工具會自動與 Visual Studio 一起安裝。 若要執行此工具,請使用 Visual Studio 開發人員命令提示字元或 Visual Studio Developer PowerShell。
在命令提示字元上鍵入下列字行:
語法
winmdexp [options] winmdmodule
參數
| 自變數或選項 | 說明 |
|---|---|
winmdmodule |
指定要導出的模組 (.winmdobj)。 只允許一個模組。 若要建立此模組,請使用 /target 編譯程式選項搭配 winmdobj 目標。 請參閱 -target:winmdobj (C# 編譯程式選項) 或 -target (Visual Basic) 。 |
/docfile:
docfile
/d:
docfile
|
指定 Winmdexp.exe 將產生的輸出 XML 檔案檔。 在 .NET Framework 4.5 中,輸出檔案基本上與輸入 XML 檔檔相同。 |
/moduledoc:
docfile
/md:
docfile
|
指定編譯程式使用 winmdmodule所產生的 XML 檔檔名稱。 |
/modulepdb:
symbolfile
/mp:
symbolfile
|
指定包含 符號的程式資料庫 (PDB) 檔案名 winmdmodule。 |
/nowarn:
warning
|
隱藏指定的警告編號。 若為 警告,請只提供錯誤碼的數值部分,而不提供前置零。 |
/out:
file
/o:
file
|
指定輸出 Windows 元資料 (.winmd) 檔案的名稱。 |
/pdb:
symbolfile
/p:
symbolfile
|
指定輸出程序資料庫 (PDB) 檔案的名稱,其中包含匯出之 Windows 元數據 (.winmd) 檔案的符號。 |
/reference:
winmd
/r:
winmd
|
指定要在匯出期間參考的元數據檔案 (.winmd 或元件)。 如果您在 “\Program Files (x86)\Reference Assemblies\Microsoft\Framework\中使用參考元件。NETCore\v4.5“ (”\Program Files\...”在32位電腦上,包含對 System.Runtime.dll 和 mscorlib.dll的參考。 |
/utf8output |
指定輸出訊息應在UTF-8編碼中。 |
/warnaserror+ |
指定所有警告都應該視為錯誤。 |
@
responsefile
|
指定包含選項的回應 (.rsp) 檔案(以及選擇性 winmdmodule的 )。 中的每個 responsefile 行都應該包含單一自變數或選項。 |
備註
Winmdexp.exe 並非設計成將任意 .NET Framework 元件轉換成 .winmd 檔案。 它需要使用 /target:winmdobj 選項編譯的模組,並套用其他限制。 這些限制中最重要的是,元件 API 介面中公開的所有類型都必須是 Windows 運行時間類型。 如需詳細資訊,請參閱
當您使用 C# 或 Visual Basic 撰寫 Windows 8.x 市集應用程式或 Windows 執行時間元件時,.NET Framework 會提供支援,讓使用 Windows 運行時間進行程式設計更為自然。 本文將討論 Windows 市集應用程式和 Windows 運行時間的 .NET Framework 支援一文。 在此程式中,一些常用的 Windows 運行時間類型會對應至 .NET Framework 類型。 Winmdexp.exe 反轉此程式,併產生使用對應 Windows 執行時間類型的 API 介面。 例如,從 IList<T> 介面建構的類型會對應至從 Windows 運行時間 IVector<T> 介面建構的類型。