---
title: "Reducing Boilerplate Code in .NET Applications with Command Line Switches"
url: https://daily.dev/posts/reducing-boilerplate-code-in-net-applications-with-command-line-switches-6srkhuzso
source_url: https://nodogmablog.bryanhogan.net/2022/09/reducing-boilerplate-code-in-net-applications-with-command-line-switches
type: article
source: "No Dogma Blog (Bryan Hogan)"
published: 2026-05-31T07:47:13.852Z
updated: 2026-05-31T08:46:43.439Z
tags: [".net"]
reading_time: 1
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Reducing Boilerplate Code in .NET Applications with Command Line Switches

**[No Dogma Blog \(Bryan Hogan\)](https://daily.dev/sources/bryanhogan)** · 1 min read · 0 upvotes · 0 comments

## Summary

A quick tip showing how to use `dotnet new` command line switches to reduce boilerplate code when scaffolding .NET Web API projects. By passing flags like `--no-https`, `--no-openapi`, `--use-minimal-apis`, and `--use-program-main`, you can cut the generated `Program.cs` from 14 lines down to 6, avoiding the need to manually delete unwanted code after project creation.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://nodogmablog.bryanhogan.net/2022/09/reducing-boilerplate-code-in-net-applications-with-command-line-switches>

---

Tags: [#.net](https://daily.dev/tags/.net)

[View this post on daily.dev](https://daily.dev/posts/reducing-boilerplate-code-in-net-applications-with-command-line-switches-6srkhuzso)
