CrmSvcUtil is only creating OrganizationServiceContext derivants (should be CrmOrganizationServiceContext)

springy76 picture springy76 · Jan 25, 2012 · Viewed 7.1k times · Source

I'm using CrmSvUtil this way:

crmsvcutil.exe /url:http://crm2011/MyTestOrg/XRMServices/2011/Organization.svc /out:GeneratedCode.cs /namespace:Xrm /serviceContextName:XrmDataContext

And the output contains thousands of business objects and this context class:

[System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "5.0.9688.1533")]
public partial class XrmDataContext : Microsoft.Xrm.Sdk.Client.OrganizationServiceContext

But looking at the samples (namely .\sdk\walkthroughs\portal\consoleappwalkthrough) I clearly can see there that the context class should be derived from a more mighty sub class of OrganizationServiceContext -> CrmOrganizationServiceContext:

[System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "5.0.9688.583")]
public partial class XrmServiceContext : Microsoft.Xrm.Client.CrmOrganizationServiceContext

I definitely need CrmOrganizationServiceContext because only then I have the constructors I need. So what I'm doing wrong or which setting did I miss?

Answer

Peter Majeed picture Peter Majeed · Jan 25, 2012

Check out the parameters given @ the web version of that SDK sample. They will generate the class you're looking for.

CrmSvcUtil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" /out:Xrm\Xrm.cs /url:http://Crm/Contoso/XRMServices/2011/Organization.svc /domain:CONTOSO /username:administrator /password:pass@word1 /namespace:Xrm /serviceContextName:XrmServiceContext