Peverify.exe (PEVerify 工具)Peverify.exe (PEVerify Tool)

本文內容

PEVerify 工具可以協助像是編譯器撰寫者、指令碼引擎開發人員等產生 Microsoft Intermediate Language (MSIL) 的開發人員，判斷其 MSIL 程式碼和相關聯的中繼資料是否符合類型安全需求。The PEVerify tool helps developers who generate Microsoft intermediate language (MSIL) (such as compiler writers, script engine developers, and so on) to determine whether their MSIL code and associated metadata meet type safety requirements.只有在避免使用某些語言建構時，某些編譯器才會產生可驗證的類型安全程式碼。Some compilers generate verifiably type-safe code only if you avoid using certain language constructs.如果您是使用這類編譯器的開發人員，可能會想要驗證您並未損及程式碼的類型安全。If, as a developer, you are using such a compiler, you may want to verify that you have not compromised the type safety of your code.在這種情況下，您可以在檔案上執行 PEVerify 工具來檢查 MSIL 和中繼資料。In this situation, you can run the PEVerify tool on your files to check the MSIL and metadata.

在 filename 所指定的組件上，執行中繼資料驗證檢查。Performs metadata validation checks on the assembly specified by filename.這會逐步檢查檔案內的所有中繼資料結構，並報告遇到的所有驗證問題。This walks the full metadata structure within the file and reports all validation problems encountered.

/nologo/nologo

不顯示產品版本和著作權資訊。Suppresses the display of product version and copyright information.

備註Remarks

通用語言執行平台透過以類型安全的方式執行應用程式程式碼，協助強制執行安全性和隔離機制。The common language runtime relies on the type-safe execution of application code to help enforce security and isolation mechanisms.正常情況下，不是可驗證型別安全的程式碼無法執行，但是您可以設定安全性原則，讓受信任但無法驗證的程式碼執行。Normally, code that is not verifiably type safe cannot run, although you can set security policy to allow the execution of trusted but unverifiable code.

如果 /md 和 /il 兩個選項都未指定，則 Peverify.exe 會執行這兩種檢查。If neither the /md nor /il options are specified, Peverify.exe performs both types of checks.Peverify.exe 會先執行 /md 檢查。Peverify.exe performs /md checks first.如果沒有任何錯誤，則會執行 /il 檢查。If there are no errors, /il checks are made.如果您同時指定 /md 和 /il，則即使中繼資料有錯誤，還是會執行 /il 檢查。If you specify both /md and /il, /il checks are made even if there are errors in the metadata.因此，如果中繼資料沒有錯誤，peverifyfilename 就相當於 peverifyfilename/md/il。Thus, if there are no metadata errors, peverifyfilename is equivalent to peverifyfilename/md/il.

下列命令會產生與上面的前一個範例相同的結果，但是會指定回應檔 ignoreErrors.rsp 中要忽略的錯誤碼。The following command produces the same result as the above previous example, but specifies the error codes to ignore in the response file ignoreErrors.rsp.