Link to home
Start Free TrialLog in
Avatar of emi_sastra
emi_sastra

asked on

Error import assembly

Hi All,

I have error for below assembly:

Imports System.Data.Services
Imports System.Data.Services.Common
Imports System.Data.Services.Providers

What references should I add ?
What component I have to install /

Thank you.
Avatar of emi_sastra
emi_sastra

ASKER

Imports System.Data.Entity.Infrastructure
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Ryan Chong,

Thanks for your answer. There are left below error.

Severity      Code      Description      Project      File      Line      Suppression State
Error      BC30652      Reference required to assembly 'Microsoft.Data.Services.Client, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' containing the type 'DataServiceProtocolVersion'. Add one to your project.       

Where to find Microsoft.Data.Services.Client ?  I can not see it at add reference.


Severity      Code      Description      Project      File      Line      Suppression State
Error            Unable to find a version of 'Microsoft.Data.Services.Client' that is compatible with 'Microsoft.Data.Services 5.0.2 constraint: Microsoft.Data.Services.Client (= 5.0.2)'.                   
 
What is this error ?

Thank you.
The above problem solved.

Imports System.Data.Services
Imports System.Data.Services.Common
Imports System.Data.Services.Providers

Severity      Code      Description      Project      File      Line      Suppression State
Error      BC30560      'DataServiceProtocolVersion' is ambiguous in the namespace 'System.Data.Services.Common'.       

How to solve it ?

Thank you.
Error      BC30560      'DataServiceProtocolVersion' is ambiguous in the namespace 'System.Data.Services.Common'.    
can you post the codes how you declare it (DataServiceProtocolVersion)?

I think you may need to declare it explicitly (with full namespace), or else remove the references which you're not using.
Hi Ryan,

Here is the code

config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3

Thank you.
can you tell us how you declare the object config ? we need to know what class is this object come from...
Here is the complete code of this class.

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Data.Services
Imports System.Data.Services.Common
Imports System.Data.Services.Providers
Imports System.Linq
Imports System.ServiceModel.Web
Imports System.Web

#If DEBUG Then
<System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults:=True)> _
<dsPelatihanDD.JSONPSupportBehavior> _
Public Class DataService
#Else
<dsPelatihanDD.JSONPSupportBehavior> _
Public Class DataService
#End If
    Inherits DataService(Of ERP_VIHARAEntities)
    Implements IServiceProvider
    ' This method is called only once to initialize service-wide policies.
    Public Shared Sub InitializeService(ByVal config As DataServiceConfiguration)
        ' TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
        ' Examples:
        ' config.SetEntitySetAccessRule("MyEntityset", EntitySetRights.AllRead)
        ' config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All)
        config.SetEntitySetAccessRule("*", EntitySetRights.All)
        'config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3

        config.DataServiceBehavior.MaxProtocolVersion = Microsoft.Data.OData.ODataVersion.V3
#If DEBUG Then
        config.UseVerboseErrors = True
#End If
    End Sub

    Public Function GetService(ByVal serviceType As Type) As Object Implements IServiceProvider.GetService
        If serviceType Is GetType(IDataServiceStreamProvider) Then
            ' Return the stream provider to the data service.
            Return New dsPelatihanDD.ImageStreamProvider()
        End If
        Return Nothing
    End Function
End Class

Is this your are looking for ?
not really doing similar thing, but to resolve the line of code:

config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3

Open in new window


it seems that we need to use Microsoft.Data.Services.Client library instead.

remove ther references of System.Data.Services.Client and remove the code below:

Imports System.Data.Services.Providers

Open in new window


DataServiceProtocolVersion Enumeration
https://msdn.microsoft.com/en-us/library/system.data.services.common.dataserviceprotocolversion(v=vs.103).aspx
If i remove Imports System.Data.Services.Providers
Then I get error Severity      Code      Description      Project      File      Line      Suppression State
Error      BC30002      Type 'IDataServiceStreamProvider' is not defined.       

  Public Function GetService(ByVal serviceType As Type) As Object Implements IServiceProvider.GetService
        If serviceType Is GetType(IDataServiceStreamProvider) Then
            ' Return the stream provider to the data service.
            Return New dsPelatihanDD.ImageStreamProvider()
        End If
        Return Nothing
    End Function

Thank you.
If I change to  config.DataServiceBehavior.MaxProtocolVersion = Microsoft.Data.OData.ODataVersion.V3

Then I get error

Severity      Code      Description      Project      File      Line      Suppression State
Warning      BC42016      Implicit conversion from 'ODataVersion' to 'DataServiceProtocolVersion'.       

Thank you.
are you inherit this project from someone else? do you have some documentation can referring to?

I think you may need to test by adding or removing some of the libraries from References

so sorry that I can't neither access to your environment for troubleshooting nor simulate the exact error you're encountering.
Hi Ryan,

- are you inherit this project from someone else?
This is brand new project.

-do you have some documentation can referring to?
No.

-I think you may need to test by adding or removing some of the libraries from References
Yes, I have tried it.
I remove the old one with this one and the compile error is gone.

config.DataServiceBehavior.MaxProtocolVersion = Microsoft.Data.OData.ODataVersion.V3

Thank you.
I remove the old one with this one and the compile error is gone.

ok, so is that mean the issue was resolved now?
- This expert suggested creating a Gigs project.
I don't get this.

- ok, so is that mean the issue was resolved now?
Yes, it is. For compile.

Thank you.
- ok, so is that mean the issue was resolved now?
Yes, it is. For compile.
ok, you may proceed to close this question if there's no further issue.
Hi Ryan,

- ok, you may proceed to close this question if there's no further issue.
I confuse how could I close this question. Which solution wiil be used to close this question?

Thank you.
see if any comment(s) above is useful

then you can:

How do I accept a comment as my solution?
http://support.experts-exchange.com/customer/portal/articles/608621-how-do-i-accept-a-comment-as-my-solution-

or

How do I delete a question?
http://support.experts-exchange.com/customer/portal/articles/610263
Hi Ryan,

Thank you very much for your help and time.