共用方式為


訊息編譯程式工作

Windows 驅動程式套件 (WDK) 會提供 MessageCompiler 工作,以便在您使用 MSBuild 建置驅動程序時執行 MC.exe 工具。 如需使用 MC.exe的相關信息,請參閱 訊息編譯程式 (MC.exe)

MSBuild 會使用 MessageCompile Item 來傳送 MessageCompiler 工作的參數。 MessageCompile 專案會存取項目檔中 mc.exe 的項目元數據。

下列範例示範如何在.vcxproj檔案中編輯元數據。

<ItemGroup>
    <MessageCompile Include="a.mc">
      <GenerateBaselineResource>true</GenerateBaselineResource>
      <BaselineResourcePath>c:\test\</BaselineResourcePath>
    </MessageCompile>
</ItemGroup>

下列範例顯示命令列呼叫:

mc.exe –s "c:\test\" a.mc

在上述範例中,MSBuild 會在檔案 a.mc 上叫用 mc.exe,並使用 –s 參數,因為元數據 GenerateBaselineResource 設定為 true。 此外,MSBuild 會使用BaselineResourcePath元數據來指定 –s 參數的自變數。

MessageCompiler 工作參數 項目元數據 工具切換
來源

選擇性字串參數。 指定要編譯的指令清單檔名稱。 指定要編譯的訊息檔名稱。

@(MessageCompile)

<filename.man>

<filename.mc>

ANSIInputFile

指定輸入檔案為 ANSI (預設值)。

%(MessageCompile.ANSIInputFile) -a
ANSIMessageInBinFile

指定 .BIN 檔案中的訊息應該使用 ANSI。

%(MessageCompile.ANSIMessageInBinFile) -A
啟用除錯輸出路徑

如果此值設定為 true,則會啟用 –x 參數。

%(MessageCompile.EnableDebugOutputPath)
DebugOutputPath

指定編譯程式放置 .dbg C include 檔案所在的資料夾。 .dbg 檔案會將訊息標識碼對應至其符號名稱。

%(MessageCompile.DebugOutputPath) -x<路徑>
EnableCallOutMacro

新增呼叫巨集,以在記錄期間叫用用戶代碼。 這個參數對 C# 無效,而且會被忽略。

%(MessageCompile.EnableCallOutMacro) -co
EventmanPath

指定 eventman.xsd 檔案的路徑。

%(MessageCompile.EventmanPath) -w<檔案>
GenerateBaselineResource

如果此值設定為 true,則會啟用 -s 開關。

%(MessageCompile.GenerateBaselineResource)
BaselineResourcePath

為每個提供者產生二進位資源。 產生全域摘要資源 MCGenResource.BIN。

%(MessageCompile.BaselineResourcePath) -s<路徑>
生成C#日誌類別

根據 FX3.5 事件類別產生 C# (Managed) 記錄類別。

%(MessageCompile.GenerateC#LoggingClass) -cs<命名空間>
產生C#靜態記錄類別

根據 FX3.5 事件類別產生靜態 C# (Managed) 記錄類別。

%(MessageCompile.GenerateC#StaticLoggingClass) -css<命名空間>
GeneratedFilesBaseName

指定所產生檔案的基底名稱。 預設值是輸入檔的基底名稱。

%(MessageCompile.GeneratedFilesBaseName) -z<basename>
GeneratedHeaderPath

如果此值設定為 true,則會啟用 -h 開關。

%(MessageCompile.GeneratedHeaderPath)
HeaderFilePath

指定要建立 C include 檔案的位置路徑。 預設值為 .。

%(MessageCompile.HeaderFilePath) -h<路徑>
GeneratedRcAndMessagesPath

如果此值設定為 true,則會啟用 -r 開關。

%(MessageCompile.GeneratedRcAndMessagesPath)
RCFilePath

指定 RC 包含檔案的路徑,以及它所包含的二進位訊息資源檔。 預設值為 .。

%(MessageCompile.RCFilePath) -r<路徑>
生成內核模式記錄宏

產生核心模式記錄巨集。

%(MessageCompile.GenerateKernelModeLoggingMacros) -公里
生成MOF檔案

產生所有產生的函式和巨集的下層支援。 MOF 檔案是從指令清單產生。 MOF 檔案會放在 「-h」 參數所指定的位置。

%(MessageCompile.GenerateMOFFile) -mof
GenerateOLE2Header

產生 OLE2 頭檔。 使用 HRESULT 定義,而不是狀態代碼定義。

%(MessageCompile.GenerateOLE2Header) -o
生成用戶模式日誌記錄巨集 (GenerateUserModeLoggingMacros)

產生使用者模式日誌巨集。

%(MessageCompile.GenerateUserModeLoggingMacros) -um
HeaderExtension

指定頭檔 (1-3 個字元) 的擴展名。

%(MessageCompile.HeaderExtension) -e<擴充功能>
MaximumMessageLength

如果任何訊息的大小超過 <長度> 字元,則會產生警告。

%(MessageCompile.MaximumMessageLength) -m<長度>
PrefixMacroName

定義套用至每個產生的記錄巨集的巨集名稱前置詞。 預設值為 「EventWrite」。

%(訊息編譯 前置宏名稱) -p<前置詞>
移除符號名稱中的字元

在形成巨集名稱之前,先定義要從每個事件符號名稱開頭移除的文字。 預設值是 NULL。

%(RemoveCharsFromSymbolName) -P<前置詞>
SetCustomerbit

設定整個訊息識別碼中的「Customer 位」。

%(MessageCompile.SetCustomerbit) -c
TerminateMessageWithNull

以訊息數據表中的 Null 字元終止所有字串。

%(MessageCompile.TerminateMessageWithNull) -n
UnicodeInputFile

輸入檔案為 Unicode。

%(MessageCompile.UnicodeInputFile) -u
UnicodeMessageInBinFile

.BIN 檔案中的訊息應該是 Unicode(預設值)。

%(MessageCompile.UnicodeMessageInBinFile) -U
UseBaseNameOfInput

指定 。BIN 檔名應包含 .mc 檔名,以取得唯一性。

%(MessageCompile.UseBaseNameOfInput) -b
UseDecimalValues

以十進位指定頭檔中的 FACILTY 和 SEVERITY 值。 一開始,將標頭中的訊息值設定為十進位。

%(MessageCompile.UseDecimalValues) -d
ValidateAgainstBaselineResource

如果此值設定為 true,則會產生 -t 開關。

%(MessageCompile.ValidateAgainstBaselineResource)
BaselinePath

根據基準資源進行驗證。

%(MessageCompile.BaselinePath) -t<路徑>
冗長

指定詳細信息輸出。

%(MessageCompile.Verbose) -v
WinmetaPath

指定 winmeta.xml 檔案的路徑。

%(MessageCompile.WinmetaPath) -W<檔案>

訊息編譯程式 (MC.exe)