Question

I have been using and old assembly that references a Dynamics CRM tenant. The assembly contains (among other things) the proxy classes for the tenant. I need to update the proxy classes to the most recent version.

I have used crmsvcutil.exe in the past to generate the proxy class filefor a tenant, but in this assembly the classes each in their own separate files. For example, there is a 'person' c-sharp file which contains the variables of the person entity and the get/set methods.

The current files are in the following format:

using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;
namespace CRM2011.Proxy.Organisation
{
    [GeneratedCode("System.Xml", "4.0.30319.1"), DesignerCategory("code"), DebuggerStepThrough, XmlType(Namespace = "http://schemas.microsoft.com/crm/2007/WebServices")]
    [Serializable]
public class thr_offer : BusinessEntity
{
    private Lookup createdbyField;
    private CrmDateTime createdonField;
    //More variables here
    public Lookup createdby
    {
        get
        {
            return this.createdbyField;
        }
        set
        {
            this.createdbyField = value;
        }
    }
    public CrmDateTime createdon
    {
        get
        {
            return this.createdonField;
        }
        set
        {
            this.createdonField = value;
        }
    }
    //More get/set methods here
}

These appear to have been generated by a tool, but I don't know of any tool that will do this. If I can generate files such as these instead of the monstrous file generated by crmsvcutil.exe it will make development much easier.

Any ideas?

Was it helpful?

Solution

The files were generated with the CRM 4.0 SDK (the CrmDateTime rang a bell).

With the CrmSvcUtil.exe from the CRM 4.0 SDK it is possible to generate separate files, as documented here:

http://msdn.microsoft.com/en-us/library/ff681563.aspx

/out parameter

Determines 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.

This "feature" has been removed from CRM 2011 SDK (if you try to specify the name without the file extension it will still generate a single file)

OTHER TIPS

You'd either have to create a splicer that splices the entities for you after they've been generated into a single file, or create CrmSvcUtil extensions that perform this basic change of behavior for you.

Edit Which the Early Bound Generator in the XrmToolBox does via configuration.

CrmSvcUtil contained in Microsoft.CrmSdk.CoreTools 9.1.0.108 support splitting entities (and other types) into single files using commandline arguments /splitfiles and /outdirectory.

NOTE: The CrmSvcUtil is not 100% clear about the /splitfiles argument, as it is referenced as /SplitToFiles by itself. 🙄

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top