Skip to content
Latchkey

C# "CS0117: type does not contain a definition for X" in CI

CS0117 fires when you reference a member (field, property, enum value, static method) directly on a type that does not declare it. The type resolved fine; the member name did not. In CI this most often means a package upgraded to a version where the member was renamed or removed.

What this error means

The build fails with CS0117 naming the type and the missing member. It is deterministic for a given set of restored package versions.

dotnet
Models/Order.cs(22,30): error CS0117: 'OrderStatus' does not contain a definition for 'Pending'

Common causes

A package upgrade renamed or removed the member

A floating version or a Directory.Packages.props bump pulled a release where the enum value or property was renamed, so the call site no longer compiles.

A typo or wrong overload target

The member name is misspelled, or the code targets a static member that is actually an instance member (or vice versa).

How to fix it

Match the call site to the current API

  1. Open the type definition for the restored version and confirm the real member name.
  2. Update the call site, or pin the package back to the version that still has the member.
  3. Rebuild.

How to prevent it

  • Pin package versions so member surfaces do not shift unexpectedly between CI runs.
  • Read release notes when bumping dependencies that you consume by member name.

Frequently asked questions

What causes ""CS0117: ... does not contain a definition""?
A floating version or a Directory.Packages.props bump pulled a release where the enum value or property was renamed, so the call site no longer compiles.
How do I fix "CS0117: ... does not contain a definition"?
Match the call site to the current API

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card