C# and .NET • Modern C# baseline
Build, Publish, and Deploy .NET Applications
Create repeatable release artifacts and verify configuration in the deployment environment.
dotnet build compiles a project; dotnet publish prepares deployment output for a target runtime and configuration. Framework-dependent and self-contained deployments have different runtime requirements and size trade-offs. Use CI to build and test the same source revision, and keep secrets outside the published artifact.
Key points
- Test the published artifact, not only the development run.
- Pin or document SDK requirements for reproducible builds.
Example
dotnet test
dotnet publish -c Release -o ./publish
What to expect
The test suite runs first; publish writes release output to the chosen directory.
Practice exercise
Add a deployment checklist for configuration, secrets, health checks, rollback, and logs.
Key idea: A successful local run is not a deployment plan; make release steps repeatable.