Share via


訊息編譯程式工作

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,因為元數據 GenerateBaselineResource 設定為 true。 此外,MSBuild 會使用BaselineResourcePath元數據來指定 –s 參數的自變數。

MessageCompiler 工作參數 項目中繼資料 工具切換
來源

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

@ (MessageCompile)

<filename.man>

<filename.mc>

ANSIInputFile

指定輸入檔是 ANSI (預設) 。

% (MessageCompile.ANSIInputFile) -a
ANSIMessageInBinFile

指定中的訊息。BIN 檔案應該是 ANSI。

% (MessageCompile.ANSIMessageInBinFile) -A
EnableDebugOutputPath

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

% (MessageCompile.EnableDebugOutputPath)
DebugOutputPath

指定編譯程式放置 .dbg C 包含檔案所在的資料夾。 .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<路徑>
GenerateC#LoggingClass

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

% (MessageCompile.GenerateC#LoggingClass) -cs<命名空間>
GenerateC#StaticLoggingClass

根據 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<路徑>
GenerateKernelModeLoggingMacros

產生核心模式記錄宏。

% (MessageCompile.GenerateKernelModeLoggingMacros) -公里
GenerateMOFFile

產生所有產生的函式和宏的下層支援。 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」。

% (MessageCompile PrefixMacroName) -p<前置詞>
RemoveCharsFromSymbolName

定義每個事件符號名稱開頭要移除的文字,再形成宏名稱。 預設值是 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)