# C# "CS0111: type already defines a member" in CI

> Fix C# "CS0111: Type already defines a member called M with the same parameter types" in CI - a duplicate method or property, often from a bad merge or a generated partial.

Source: https://latchkey.dev/learn/dotnet/dotnet-cs0111-already-defines-member-in-ci  
Updated: 2026-06-26

CS0111 fires when two members in the same type have the same name and identical parameter types - they are not valid overloads. In CI this is usually a merge that duplicated a method, or a generated partial class colliding with a hand-written one.

## Diagnose it: SDK version and restore first

Most .NET CI failures are an SDK mismatch or a restore that did not happen. `global.json` pins the SDK, and if the runner does not have that exact version the failure message is about the project rather than the SDK.

```Terminal
dotnet --info
cat global.json 2>/dev/null

# restore explicitly so a restore failure is not reported as a build failure
dotnet restore --verbosity normal
dotnet build --no-restore -warnaserror
```

> Pin the SDK with `global.json` and install exactly that version with `actions/setup-dotnet`. A floating SDK turns a runner image update into a build break on unchanged code.

## FAQ

### What causes C# "CS0111: type already defines a member" in CI?

There are 2 common causes: a merge duplicated the member and a generated partial collides with hand-written code. A three-way merge kept both sides of an edited method, producing two identical signatures in one type.

### How do I fix C# "CS0111: type already defines a member" in CI?

Remove the duplicate. Delete one of the two identical members, keeping the intended implementation.

### What does C# "CS0111: type already defines a member" in CI actually mean?

The build fails with CS0111 naming the duplicated member and type.

### How do I stop C# "CS0111: type already defines a member" in CI happening again?

Review merges for duplicated method bodies. The prevention section lists 2 changes that keep it from recurring.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
