CS1061 🟪 .NET

error CS1061: 'X' does not contain a definition for 'Y' and no accessible extension method 'Y' accepting a first argument of type 'X' could be found

The member you call doesn’t exist on that type — typo, wrong type, missing using for an extension method, or an API removed in a newer version.

Seen on: .NET

Meaning

Extension methods (LINQ, AddDbContext, UseSqlServer) need their namespace and package. Upgrading packages can remove/rename members.

Common causes

  • Missing using for extension methods (System.Linq, Microsoft.EntityFrameworkCore)
  • Package for the extension not installed (e.g. EF provider)
  • Variable is a different type than assumed
  • API removed/renamed in a newer version

⚡ Quick fix

  1. Add the using/package that provides the extension
  2. Check the variable’s actual type
  3. Look up the migration notes for renamed APIs

Detailed fix by platform

Shell

  1. dotnet add package Microsoft.EntityFrameworkCore.SqlServer

How to diagnose

  1. Type — Actual type of the expression
  2. Extension — Package and namespace

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.