C# Error
CS1110 – Cannot define a new extension method because the compiler required type ‘{0}’ cannot be found. Are you missing a reference to System.Core.dll?
Reason for the Error & Solution
Cannot use ‘this’ modifier on first parameter of method declaration without a reference to System.Core.dll. Add a reference to System.Core.dll or remove ‘this’ modifier from the method declaration.
Extension methods are supported on version 3.5 and later of .NET Framework. Extension methods generate metadata which marks the method with an attribute. The attribute class is in system.core.dll.
To correct this error
- As the message states, add a reference to System.Core.dll or remove the
this
modifier from the method declaration.
Example
The following example generates CS1110 if the file is not compiled with a reference to System.Core.dll:
// cs1110.cs
// CS1110
// Compile with: /target:library
public static class Extensions
{
public static bool Test(this bool b) { return b; }
}