locked
The type 'System.Data.Services.Client.DataServiceContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Data.Services.Client.SL, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. RRS feed

  • Question

  • I have created a VS2013 solution that contains silverlight project where I'm adding CRM REST service as service reference so that I can use the XAP in CRM 2013 to open this silverlight component.

    But on build I'm getting following error.

    The type 'System.Data.Services.Client.DataServiceContext' is defined in an assembly that is not referenced. 
    You must add a reference to assembly 'Microsoft.Data.Services.Client.SL, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

    Need immediate help.

    Monday, September 22, 2014 1:32 PM

Answers

  • Issue has been resolved. I had to add Microsoft.Data.Services.Client.SL and delete System.Data.Services.Client manually worked out.

    Greatly appreciate your help.

    • Marked as answer by Pooja47 Tuesday, September 23, 2014 11:48 AM
    Tuesday, September 23, 2014 11:48 AM

All replies

  • Hi,

    Please reference the post below:

    http://stackoverflow.com/questions/10889274/wcf-5-0-and-odata-3-0-api-not-work-with-azure-table-storage

    Saad

    Monday, September 22, 2014 1:40 PM
  • I'm not using azure. I'm adding CrmOdata reference to my solution which is using System.Data.Services.Client.DataServiceContext and this is creating me error when I'm trying to use this Context to get CRM Data.

    

    Tuesday, September 23, 2014 6:22 AM
  • Please add this reference System.Data.Services.Client

    Saad

    Tuesday, September 23, 2014 6:34 AM
  • You should System.Data.Services.Client this namespace to your project. Clean the solution and rebuild.

    And also make sure you have a entry in web.config like below

    <system.web>
      <compilation debug="true" targetFramework="5.0">
        <assemblies>
          <add assembly="System.Data.Services.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
        </assemblies>
      </compilation>
    </system.web>

    If that also did not work

    UnInstall and re nstall the storage again

    UnInstall-Package WindowsAzure.Storage
    
      Install-Package Microsoft.Data.Services.Client -Version 5.0.0
    
      Install-Package WindowsAzure.Storage


    Sreeni Pavalla


    Tuesday, September 23, 2014 6:40 AM
  • I did everything u suggested. Nothing works. I'm new to silverlight. Appreciate your help.

    I have added the OData service reference in a silverlight project X and I'm referring this X in another project Y in same solution. 


    • Edited by Pooja47 Tuesday, September 23, 2014 9:59 AM
    Tuesday, September 23, 2014 7:05 AM
  • Try adding oData Service in Y directly, to rule out there is no issues while refering X into Y.

    If you still issue, There is something else. Make sure that the version specified in web.config and version added are same.

    Thanks,


    Sreeni Pavalla

    Tuesday, September 23, 2014 7:15 AM
  • Hi Pooja,

    Please send your code and Reference screenshot.

    You can also refer to Walkthrough: Use the SOAP Endpoint for Web Resources with Silverlight in SDK

    Saad


    • Edited by Mohd Saad Tuesday, September 23, 2014 7:29 AM added clarification
    Tuesday, September 23, 2014 7:18 AM
  • I'm using X oData service in other silverliht projects in the same solution. X is like a common that will be referred in all other silverlight projects.
    Tuesday, September 23, 2014 10:23 AM
  • This is the refernce.cs that gets added on adding REST OData CRM service as service reference

    namespace MS.Crm.Silverlight.SM.Common.CrmOData
    {

        /// <summary>
        /// There are no comments for MSDemoContext in the schema.
        /// </summary>
        public partial class MSDemoContext : global::System.Data.Services.Client.DataServiceContext
        {
            /// <summary>
            /// Initialize a new MSDemoContext object.
            /// </summary>
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]

    I'm using this MSDemoContext to get CRM data in other silverlight project of same solution where its giving error.

    using MS.Crm.Silverlight.SM.Common.CrmOData;
    using SOAP = MS.Crm.Silverlight.SM.Common.CrmSoap;
    using MS.Crm.SL.SM.KeyIssueCompetitveComparison;
    
    namespace MS.Crm.SL.SM.SalesStrategy
    {
        public class CrmLogic
        {
            #region Declaration
    
            private String errorDetails;
            private MSDemoContext crmContext; //I'm getting error here that assembly reference is missing
            private SynchronizationContext _syncContext;

        
    Tuesday, September 23, 2014 10:32 AM
  • Issue has been resolved. I had to add Microsoft.Data.Services.Client.SL and delete System.Data.Services.Client manually worked out.

    Greatly appreciate your help.

    • Marked as answer by Pooja47 Tuesday, September 23, 2014 11:48 AM
    Tuesday, September 23, 2014 11:48 AM