Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0011

The base class or interface 'class' in assembly 'assembly' referenced by type 'type' could not be resolved

A class that was imported from a file with /reference, is derived from a class or implements an interface that is not found. This can occur if a required DLL is not also included in the compilation with /reference.

For more information, see Add Reference Dialog Box and /reference (Import Metadata) (C# Compiler Options).

// CS0011_1.cs
// compile with: /target:library

public class Outer 
{
   public class B { }
}

The second file creates a DLL that defines a class C that is derived from the class B that was created in the previous example.

// CS0011_2.cs
// compile with: /target:library /reference:CS0011_1.dll
// post-build command: del /f CS0011_1.dll
public class C : Outer.B {}

The third file replaces the DLL created by the first step, and omits the definition of the inner class B.

// CS0011_3.cs
// compile with: /target:library /out:cs0011_1.dll
public class Outer {}

Finally, the fourth file references the class C defined in the second example, which is derived from class B, and which is now missing.

The following sample generates CS0011.

// CS0011_4.cs
// compile with: /reference:CS0011_1.dll /reference:CS0011_2.dll
// CS0011 expected

class M
{
   public static void Main()
   {
      C c = new C();
   }
}

Community Additions

ADD
Show:
© 2014 Microsoft