---
title: ".NET"
description: "Deploy .NET and C# applications on Miget with automatic SDK detection."
---
Miget Buildpacks automatically detect and build your .NET applications when you select **Auto detection (Miget Buildpacks)** as the build method. The appropriate SDK and runtime versions are resolved automatically. For the full reference, visit the [migetpacks .NET documentation](https://migetpacks.com/languages/dotnet).
## Detection
Your application is detected as .NET when one of these files is present in the root directory:
- `*.sln`
- `global.json`
- `*.csproj`
## Version Detection
The .NET SDK and runtime versions are determined from the following sources, in order of priority:
1. `global.json` (e.g., `sdk.version`)
2. `TargetFramework` in `*.csproj` (e.g., `net8.0`)
If no version is specified, a recent stable .NET version is used.
## Build Process
During the build, the following steps are performed:
1. **SDK image** - The .NET SDK is used during the build phase to compile and publish your application.
2. **Runtime image** - The production image uses the ASP.NET runtime, which is smaller and optimized for running applications.
3. **Source cleanup** - After publishing, source files are removed from the final image to reduce its size.
4. **.NET tool restore** - If your project uses .NET tools, they are restored automatically during the build.
## Run Command
The run command is auto-detected from your project configuration. Typically, it runs the compiled DLL using the `dotnet` runtime. You can override it with a `Procfile`.
You can also override the run command directly in the Miget dashboard when creating your app or changing the deployment source.
## Configuration
You can customize the build and runtime behavior through the Miget dashboard and repository configuration files:
- **Environment variables** - Set under **Settings -> Variables** in the Miget dashboard
- **Procfile** - Define the start command at the root of your repository
- **app.json** - Application manifest for additional configuration
- **Project Path** - For monorepo setups, specify the subdirectory containing your application code in the **Advanced** tab
- **Pre-Deploy Command** - Run a command before deployment (e.g., database migrations) in the **Advanced** tab
- **Post-Deploy Command** - Run a command after successful deployment (e.g., seeding data, cache warming) in the **Advanced** tab
## Docker Hardened Images
You can enable Docker Hardened Images (DHI) in the **Advanced** tab when creating your app or changing the deployment source. When enabled, your application is built using distroless runtime images with a minimal attack surface, no shell, and no package manager.
For the complete reference, see the [migetpacks .NET documentation](https://migetpacks.com/languages/dotnet).