Search code examples
c#sql-serverpowershellxmla

Class is inaccessible due to its protection level in DLL reference


I've seen this error in C# before when referencing a class with private properties, but I'm at a loss here, as this class has public properties. It's actually a microsoft .dll

I'm creating a new object:

XmlaClient clnt = new XmlaClient();

But that's where the "Class is inaccessible due to its protection level" error is coming from. I look at the class (dll) definition, and it shows all the items inside are public. Here's an excerpt:

using System.Data;

namespace Microsoft.AnalysisServices
{
    internal class XmlaClient
    {
        public XmlaClient();

        public ConnectionInfo ConnectionInfo { get; }
        public IdentityTransferToken IdentityTransferToken { get; set; }
        #etc etc

One thing I noticed is the namespace is different than my project's. My other .dll references have their own unique namespaces, so I didn't think that was the issue. Just a thought though.

Edit: Attempting to use Microsoft.AnalysisServices.AdomdClient.dll now. It seems quite a bit different than the previous DLL though.


Solution

  • The class itself is not public

    internal class XmlaClient
    ^^^^^^^^