CrmSvcUtil Command-Line Parameters
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

CrmSvcUtil Command-Line Parameters

Dynamics
banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

You can use the CrmSvcUtil command-line tool to generate the data context and data transfer object classes for your Microsoft Dynamics CRM organization.

The parameters that can be used at the command prompt are listed in the following table.

Parameter nameDescription
/connectionStringSpecifies a connection string to the Microsoft Dynamics CRM system that you wish to generate relevant classes for. For more information, see Connect to the Microsoft Dynamics CRM Server.
/serverSpecifies the credentials of the user running CrmSvcUtil that will be used to connect to the server. For integrated authentication only, use this parameter instead of a full connection string.
/generateIndicates whether the tool will generate C# code or intermediate XML. If no parameter is specified, C# code is generated. For XML output, type the parameter as follows: /generate:xml.
/outDetermines the name of the .cs or .xml output file and whether there is one file or one per entity. It may include a full path. If you specify a name that does not end with .cs or .xml, CrmSvcUtil will write an individual .cs file for every entity in the system to the folder you specify.

For example, /out:MyClasses outputs a class file (.cs) for every entity to a folder called MyClasses.However, /out:MyClasses.cs outputs a class file (MyClasses.cs) that contains all entities.

/metadataSpecifies the input XML metadata file used to control output behavior, for example, /metadata:"MyMetadataNamespaces.xml".
/prefixContains a comma-delimited list of entity prefixes that exist in the Microsoft Dynamic CRM metadata, for example, /prefix:"new,my,ISV".
/namespaceSpecifies the namespace for the generated classes, for example, /namespace:MyCompany.Xrm.
/entityNameSpecifies generating a class for one specific entity, for example, /entityName:"account".
/dataContextPrefixContains a prefix to be used in the naming of all context classes. For example, if you type /dataContextPrefix: "My", this produces the following context classes: MyDataContext, MyCmsDataService, and MyCmsDataServiceDataContext
/dataContextClassNameSpecifies the name used for the data context class that contains the set of entities. Data context class names can alternatively be controlled by input metadata, for example, /dataContextClassName:"MyDataContext".
/classNameFormatContains a format string that defines a modifier for the entity class names. This allows a global prefix or suffix to be added to every entity class. For example, you can type /classNameFormat: "My{0}" or /classNameFormat:"{0}Entity".
/useDisplayNamesSpecifies whether to use the Microsoft Dynamics CRM schema names for your classes or use the configured label names. The default is to us schema names, for example, account, incident, and contact. If you use this parameter the class names will be, for example, Account, Case, and Contact.

Examples

The following example shows how to run CrmSvcUtil to create the classes for the Microsoft Dynamics CRM demonstration Virtual PC, which uses a server name of 'crm' and an organization name of 'Contoso'. The data context class name prefix is Contoso, which produces class names such as ContosoDataContext and ContosoDataService, in the Contoso.Xrm namespace. The classes will be generated using the schema names from the customizations for the Contoso organization:

crmsvcutil /server:"http://crm/Contoso" /namespace:Contoso.Xrm /dataContextPrefix:Contoso /out:Xrm.cs

The following example shows how to run CrmSvcUtil to create the classes for a Microsoft Dynamics CRM Online deployment that has an organization name of 'Contoso'. The data context class name prefix is Contoso, which produces class names such as ContosoDataContext and ContosoDataService, in the Contoso.Xrm namespace. The classes will be generated using the schema names from the customizations for the Contoso organization:

crmsvcutil /connectionString:"Authentication Type=Passport; Server=https://contoso.crm.dynamics.com/contoso; User ID=user-windows-live-id; Password=user-password"; Device ID=user-defined-device-id; Device Password=user-defined-device-password" /namespace:Contoso.Xrm /dataContextPrefix:Contoso /out:Xrm.cs

The following example shows how to run CrmSvcUtil to create the classes for an internet facing deployment that has an organization name of 'Contoso'. The data context class name prefix is Contoso, which produces class names such as ContosoDataContext and ContosoDataService, in the Contoso.Xrm namespace. The classes will be generated using the schema names from the customizations for the Contoso organization:

crmsvcutil /connectionString:"Authentication Type=SPLA; Server= http://crm-server-name/Contoso; User ID=user-name; Password=user-password" /namespace:Contoso.Xrm /dataContextPrefix:Contoso /out:Xrm.cs

See Also

Concepts


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2016 Microsoft