Rediger

Del via


Winmdexp.exe (Windows Runtime Metadata Export Tool)

The Windows Runtime Metadata Export Tool (Winmdexp.exe) transforms a .NET Framework module into a file that contains Windows Runtime metadata. Although .NET Framework assemblies and Windows Runtime metadata files use the same physical format, there are differences in the content of the metadata tables, which means that .NET Framework assemblies are not automatically usable as Windows Runtime Components. The process of turning a .NET Framework module into a Windows Runtime component is referred to as exporting. In .NET Framework 4.5 and 4.5.1, the resulting Windows metadata (.winmd) file contains both metadata and implementation.

When you use the Windows Runtime Component template, which is located under Windows Store for C# and Visual Basic in Visual Studio 2013 or Visual Studio 2012, the compiler target is a .winmdobj file, and a subsequent build step calls Winmdexp.exe to export the .winmdobj file to a .winmd file. This is the recommended way to build a Windows Runtime component. Use Winmdexp.exe directly when you want more control over the build process than Visual Studio provides.

This tool is automatically installed with Visual Studio. To run the tool, use Visual Studio Developer Command Prompt or Visual Studio Developer PowerShell.

At the command prompt, type the following:

Syntax

winmdexp [options] winmdmodule  

Parameters

Argument or option Description
winmdmodule Specifies the module (.winmdobj) to be exported. Only one module is allowed. To create this module, use the /target compiler option with the winmdobj target. See -target:winmdobj (C# Compiler Options) or -target (Visual Basic).
/docfile: docfile

/d: docfile
Specifies the output XML documentation file that Winmdexp.exe will produce. In .NET Framework 4.5, the output file is essentially the same as the input XML documentation file.
/moduledoc: docfile

/md: docfile
Specifies the name of the XML documentation file that the compiler produced with winmdmodule.
/modulepdb: symbolfile

/mp: symbolfile
Specifies the name of the program database (PDB) file that contains symbols for winmdmodule.
/nowarn: warning Suppresses the specified warning number. For warning, supply only the numeric portion of the error code, without leading zeros.
/out: file

/o: file
Specifies the name of the output Windows metadata (.winmd) file.
/pdb: symbolfile

/p: symbolfile
Specifies the name of the output program database (PDB) file that will contain the symbols for the exported Windows metadata (.winmd) file.
/reference: winmd

/r: winmd
Specifies a metadata file (.winmd or assembly) to reference during export. If you use the reference assemblies in "\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5" ("\Program Files\..." on 32-bit computers), include references to both System.Runtime.dll and mscorlib.dll.
/utf8output Specifies that output messages should be in UTF-8 encoding.
/warnaserror+ Specifies that all warnings should be treated as errors.
@ responsefile Specifies a response (.rsp) file that contains options (and optionally winmdmodule). Each line in responsefile should contain a single argument or option.

Remarks

Winmdexp.exe is not designed to convert an arbitrary .NET Framework assembly to a .winmd file. It requires a module that is compiled with the /target:winmdobj option, and additional restrictions apply. The most important of these restrictions is that all types that are exposed in the API surface of the assembly must be Windows Runtime types. For more information, see the "Declaring types in Windows Runtime Components" section of the article Creating Windows Runtime Components in C# and Visual Basic.

When you write a Windows 8.x Store app or a Windows Runtime component with C# or Visual Basic, the .NET Framework provides support to make programming with the Windows Runtime more natural. This is discussed in the article .NET Framework Support for Windows Store Apps and Windows Runtime. In the process, some commonly used Windows Runtime types are mapped to .NET Framework types. Winmdexp.exe reverses this process and produces an API surface that uses the corresponding Windows Runtime types. For example, types that are constructed from the IList<T> interface map to types that are constructed from the Windows Runtime IVector<T> interface.

See also