Udostępnij za pośrednictwem


Proxy Generation Tool (ProxyGen.exe)

The Proxy Generation tool (ProxyGen.exe) is a command-line tool that you use to create proxies for each object in your application's object model. You create proxies to expose the object model to add-in developers. For more information, see Creating Proxies and Walkthrough: Creating a Proxy Assembly.

By default, ProxyGen.exe is installed to the following folder: %ProgramFiles%\Visual Studio Tools for Applications 2.0 SDK\build number\Visual Studio Tools For Applications\Tools\ProxyGen.

The command-line arguments and options for ProxyGen.exe are not case-sensitive and can be supplied in any order.

proxygen /l:path /o:path [/f] [/q] [/n] [/g]
proxygen /i:path /c:path [/f] [/q] [/n] [/g]

Arguments

ProxyGen.exe requires one of the following combinations of arguments:

  • /l and /o (to generate an XML proxy descriptor file).

  • /i and /c (to generate a C# proxy code file).

No other combinations of these arguments are valid. For more information about proxy descriptor files and proxy code files, see Creating Proxies.

Argument

Description

/library:full path

-or-

/l:full path

Specifies the full path of the COM type library or managed assembly that ProxyGen.exe uses as the basis for the proxies.

/xmlOutput:full path

-or-

/o:full path

Specifies the full path of the proxy descriptor file that ProxyGen.exe generates.

If the file already exists, ProxyGen.exe returns an error and no file is generated. To overwrite the existing file, use the /force option.

/xmlInput:full path

-or-

/i:full path

Specifies the full path of the proxy descriptor file that contains the type information to use to create the proxy code file.

/codefile:full path

-or-

/c:full path

Specifies the full path of the proxy code file that ProxyGen.exe generates.

ProxyGen.exe also creates a separate code file that contains the implementation of a type map provider. For more information, see Mapping Host Types to Proxy Types.

The type map provider code file has the same name as the proxy code file, with the string .HostTypeMapProvider appended to the file name. For example, if the /c:full path argument specifies the file name Proxy.cs, then the name of the type map provider code file is Proxy.HostTypeMapProvider.cs. The type map provider is always generated in the namespace Microsoft.VisualStudio.Tools.Applications.HostTypeMapProvider.

If either file already exists, ProxyGen.exe returns an error and no file is generated. To overwrite the existing file, use the /force option.

Options

You can pass the following optional parameters to ProxyGen.exe.

Option

Description

/force

-or-

/f

Overwrites any existing files. If /force is specified, all output files are overwritten unless they are read-only or inaccessible.

/namespace

-or-

/n

Specifies the namespace of the generated proxies.

Note

This option has no effect on the namespace of the type map provider. The type map provider is always generated in the namespace Microsoft.VisualStudio.Tools.Applications.HostTypeMapProvider.

/quiet

-or-

/q

Displays no progress messages or other information. Errors and warnings are still displayed.

/help

-or-

/?

Displays help text. If /help is specified, ProxyGen.exe ignores all other arguments and options.

/nologo

-or-

/g

Suppresses banner text.

Error Codes for Warnings and Errors

ProxyGen.exe displays warnings or errors in the Command Prompt window if it encounters problems with the specified arguments or options. Each of these warnings and errors is associated with an error code. The following table describes the ranges of error codes.

Error code

Description

10000 - 10080

General errors about command line arguments.

11010 - 11230

Errors about unsupported constructs in the specified assembly, type library, or proxy descriptor file.

21010 - 21130

Warnings about constructs in the specified assembly, type library, or proxy descriptor file.

See Also

Tasks

Walkthrough: Creating a Proxy Assembly

Concepts

Creating Proxies

Architecture of Generated Proxy Code

ProxyGen Descriptor Schema Reference

Other Resources

Tools (Visual Studio Tools for Applications)