Type or namespace name XrmServiceContext could not be found RRS feed

  • Question

  • Type or namespace name XrmServiceContext could not be found (are you missing a using directive or assembly reference?)

    I am building a portal to connect to CRM 2011 and I am using this http://msdn.microsoft.com/en-us/library/gg695790.aspx

     tutorial. But I am getting the following error when I try to follow the last part of the tutorial "Create another webpage-contact grid 3"

    Here is the screenshot of the error I get 

    Thursday, December 19, 2013 3:29 PM

All replies

  • I have created the XRM.cs class already and it is in my App_Code. I am stuck at this error badly. Does it have to do with any reference or my web.config?

    Thursday, December 19, 2013 3:30 PM
  • Hello,

    Could you please provide a line using which you've generated XRM.cs?

    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Thursday, December 19, 2013 4:40 PM
  • CrmSvcUtil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" /out:Xrm\Xrm.cs /url:http://<servername>/<OrgName>/XRMServices/2011/Organization.svc /domain:***** /username:***** /password:**** /namespace:Xrm /serviceContextName:XrmServiceContext

    I later added the Xrm.cs to the App_Code of my Project

    Thursday, December 19, 2013 8:17 PM
  • Hello,

    Try to add

    using Xrm;

    to your using section.

    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Friday, December 20, 2013 1:10 AM
  • add namespace using Xrm;

    ms crm

    Friday, December 20, 2013 6:18 AM
  • Hey i have tried adding using Xrm; but it also gives an error. Do I need to add an assembly before adding namespace Xrm?

    And if yes, then which assembly?

    Friday, December 20, 2013 12:05 PM
  • Hi

    microsoft.xrm.client, microsoft.xrm.portal, microsoft.xrm.portal.files, microsoft.xrm.sdk,

    microsoft.crm.sdk.proxy, system.runtime.serilization, system.servicemodel

    Add all these references.

    Hope this help

    Friday, December 20, 2013 12:17 PM
  • Use the name space of xrm.cs page in your code file, i think it is Xrm\Xrm.

    Friday, December 20, 2013 1:17 PM
  • I should write using Xrm\Xrm in my code behind file? 
    Friday, December 20, 2013 1:21 PM
  • Hi! Could you find the answer? I have the same problem :S
    Monday, May 26, 2014 10:59 AM
  • I am also facing the same issue. I have created console application and created Xrm.cs but have not added it to the project because I am not able to find at which location Xrm.cs is created. 
    Thursday, March 23, 2017 10:18 AM
  • Hi Reshu29,

    It should be in the bin folder of the SDK.

    Sachith Chandrasiri

    Thursday, March 23, 2017 11:19 PM
  • Check the properties on XRM.cs to ensure the build action is set to compile
    Friday, March 24, 2017 11:04 AM