# Fix "warning NETSDK1138: The target framework 'net6.0' is out of support" and Get a .NET 6 API Running on .NET 10

Yes. An agent retargets the project to net10.0, moves the packages that break on the new runtime, and calls every endpoint to prove the API still works.

[Run this on Rush](https://cloud.getrush.ai/run/fix-netsdk1138-target-framework-out-of-support/dotnet/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads the project file first, because the warning is the start of a chain and the packages decide how long it is. In an API like cornflourblue/dotnet-6-crud-api, `WebApi.csproj` targets `net6.0` with `ImplicitUsings` and four packages: `AutoMapper` 11.0.1, `AutoMapper.Extensions.Microsoft.DependencyInjection` 11.0.0, `BCrypt.Net-Next` 4.0.3 and `Microsoft.EntityFrameworkCore.InMemory` 6.0.3. `Program.cs` registers `AddAutoMapper`, an in-memory `DataContext`, and runs on `http://localhost:4000`; `UsersController` exposes GET, POST, PUT and DELETE under `/users`.

On a current SDK, 10.0.403, `dotnet build` succeeds with `warning NETSDK1138: The target framework 'net6.0' is out of support and will not receive security updates in the future`, from `Microsoft.NET.EolTargetFrameworks.targets`, plus `warning NU1903: Package 'AutoMapper' 11.0.1 has a known high severity vulnerability`. `dotnet run` then fails: `You must install or update .NET to run this application`, naming `Microsoft.NETCore.App` 6.0.0 as the missing framework, because the SDK ships only the 10.0 runtime. The official release index lists 6.0 as end of life since November 2024, 8.0 and 9.0 in maintenance until November 10, 2026, and 10.0 as the active long-term-support release, so `net10.0` is the target.

Retargeting alone is not the fix. With `net10.0` and `Microsoft.EntityFrameworkCore.InMemory` 10.0.14 the build passes, but every request answers `{"message":"GenericArguments[0], 'System.Char', on 'T MaxFloat[T](IEnumerable<T>)' violates the constraint of type 'T'."}`. The stack trace in the console names `AutoMapper.Internal.TypeDetails.GetPublicNoArgExtensionMethods` calling `MakeGenericMethod` on `System.Linq.Enumerable.MaxFloat` with `char`, which the .NET 10 runtime refuses with a `VerificationException`. Swapping EF Core for 9.0.11 or 10.0.0 changes nothing, so AutoMapper 11 is the package that cannot run on this runtime.

The agent moves AutoMapper to 13.0.1, where the dependency-injection extension lives in the main package, and removes the separate `AutoMapper.Extensions.Microsoft.DependencyInjection` reference; `AddAutoMapper` in `Program.cs` compiles unchanged. Then it starts the app and calls it: `GET /users` returns `[]`, `POST /users` returns `User created`, `PUT /users/1` returns `User updated`, the next `GET` lists the user with the new first name, and `DELETE /users/1` returns `User deleted`, the same answers the original gives on a .NET 6 runtime. `NU1903` still prints for 13.0.1: the advisory, GHSA-rvv3-g6hj-g44x, names 15.1.1 as the first patched version, and moving to that major is listed as a separate change.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Our .NET API builds with \"warning NETSDK1138: The target framework 'net6.0' is out of support\" and dotnet run fails on a machine with only the current runtime. Read the project file and Program.cs, retarget to the current long-term-support framework, move each package to a version that runs there, and start the app and call every endpoint to prove it behaves as before. If a package fails at runtime after the retarget, read the stack trace, name the package, and fix that one. Open a pull request quoting the build warnings before, the endpoint responses after, and any warning that remains with the version that would clear it.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

A pull request that changes `WebApi.csproj`: the target framework, the EF Core in-memory provider version, the AutoMapper version, and one removed package reference. No C# file changes. The description quotes the NETSDK1138 and NU1903 lines from the original build, the runtime error and the AutoMapper frame from the first retarget attempt, and the five endpoint responses from the branch.

A reviewer checks that `AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies())` still resolves against the single AutoMapper package, that `BCrypt.Net-Next` was left alone because it needed no change, and that the endpoint answers match the original's on a .NET 6 runtime, which the description also quotes.

The remaining `NU1903` warning is explained rather than hidden: the advisory's patched version is a later major with its own changes, so the pull request names it and stops there.

## Run it on every repository targeting a framework past its end of support

The SDK prints NETSDK1138 on every build, so any CI log is the signal. A handler on your server that reads build logs starts this run per repository with `POST /o/{org}/sessions`, sending a UUID v5 of the repository name as `request_id` so a second log from the same repository returns the run already started.

A `schedule` trigger with a monthly `cron` in your `timezone` works for a Project that holds one .NET repository: the run builds, reads the warnings, and opens a pull request only when a target framework is out of support.

## Why run it on Rush?

A retarget looks like a one-line change until a package fails at runtime, and the failure here is a reflection error with no mention of AutoMapper in its message. In a Rush sandbox the agent installs the SDK, reads the full stack trace from the running process, swaps packages one at a time, and keeps every build and request log, so the pull request names the real cause.

Behaviour is proven by calling the API, not by a green build. The agent runs the original on a .NET 6 runtime and the branch on .NET 10 and quotes the same five responses from both, which is the comparison a reviewer would otherwise have to make by hand.

## Frequently asked questions

### Why not target net8.0 and keep more packages as they are?

Because the release index puts 8.0 in maintenance with support ending on November 10, 2026, so a retarget there would print the same warning within days. 10.0 is the active long-term-support release, with support listed into 2028.

### Why does the app fail at runtime after retargeting when the build passes?

AutoMapper 11 builds a table of LINQ extension methods with reflection at first use, and on .NET 10 `MakeGenericMethod` refuses `Enumerable.MaxFloat` for `char`. The build does not run that code, so only a request shows it. AutoMapper 12 and 13 both run; the pull request uses 13.0.1, which absorbs the DI extension package.

### Does the NU1903 vulnerability warning go away?

Not in this pull request. The advisory GHSA-rvv3-g6hj-g44x lists 15.1.1 as the first patched version, and AutoMapper 15 is a later major. The description names it so the team can take that upgrade on its own terms.

### What proves the API still works?

The agent starts it and calls GET, POST, PUT, GET and DELETE on `/users`, and quotes the JSON each returns, next to the same calls made against the original project on a .NET 6 runtime.

## More .NET jobs

- [Review Pull Requests on a .NET Solution](https://getrush.ai/run/review-pull-requests/dotnet/)
- [Write Unit Tests for a .NET App](https://getrush.ai/run/write-unit-tests/dotnet/)
- [Add API Versioning to ASP.NET Core Minimal API Endpoints](https://getrush.ai/run/add-api-versioning/dotnet/)

## More jobs like this: Fix a bug from an alert

- [Fix "RuntimeError: There is no current event loop" on Python 3.14](https://getrush.ai/run/fix-no-current-event-loop-runtime-error/asyncio/)
- [Fix "no matches for kind Ingress in version extensions/v1beta1" in Kubernetes Manifests](https://getrush.ai/run/fix-no-matches-for-kind-ingress/kubernetes/)
- [Fix "ModuleNotFoundError: No module named 'asyncore'" on Python 3.12](https://getrush.ai/run/fix-no-module-named-asyncore/asyncore/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
