Setup Dotnet Gitignore

This documentation was generated with the assistance of AI. Please report any inaccuracies.

Create or refresh the root .gitignore of a plain .NET repository — a class library, a service, or a command-line tool such as the layout produced by Setup Dotnet Cli. The template is a trimmed, house-style version of what such a solution produces, not GitHub’s 400-line Visual Studio file. It never overwrites an existing .gitignore without showing a diff and getting approval.

Purpose

iru-setup-dotnet-gitignore ignores .NET build output ([Bb]in/, [Oo]bj/, the .NET 8+ artifacts/ layout holding Native AOT publish output, NuGet tool packages, man page and completions, and publish/), Visual Studio/Rider/VS Code user state, test and coverage output (TestResults/, .trx, coverage.xml, coveragereport/), analyzer SARIF logs, NuGet packages, signing material (.pfx, .p12, .key — but not .snk), the Antora build output, OS files and the repository-wide .integration-test.lock/. A DocFX section covering the docfx.json metadata dest and site output folders is added only when a docfx.json exists. For a command-line tool with a Terminal.Gui terminal UI (a *.csproj references Terminal.Gui, or a root .ui-quality.yml exists) a terminal-UI section ignores .ui-screenshots/, the directory the UI tests write their text captures to (see Building user interfaces); .ui-quality.yml itself is configuration and is never ignored.

It never ignores the generated-but-committed docs/modules/ROOT/pages/cli-reference.adoc, and checks the draft with git check-ignore against build props, solution, .editorconfig, DocFX sources and project files. It stops and points to Setup Windows Gitignore for Windows desktop apps (WPF, WinUI 3, Windows Forms, MSIX). When .gitignore exists it announces an update, shows a diff and asks Update / Keep as is / Replace.

Plugin

Shipped by the iru-dotnet plugin of the ai-catalog marketplace (install with /plugin install iru-dotnet@ai-catalog; see Plugins).

Invocation

/iru-setup-dotnet-gitignore

Optionally with an args block of key: value lines (see below) for scripted runs.

Inputs

Argument Required Description Default

mode

No

new or existing. An existing file still goes through the Update / Keep as is / Replace question unless on-existing decides.

Detected from the root .gitignore

on-existing

No

ask, keep, update or replace — how to treat an existing .gitignore in scripted runs; the warning and diff are still printed.

ask

Any other key forwarded by Setup CLI Repository (such as language, bin-name or ui) is ignored and named in the report.

Outputs

  • A root .gitignore — created, updated (merged, keeping hand-added lines), replaced with the template, or left untouched when kept as is.

  • A report stating whether the run was from scratch or an update, the action taken (created / updated / replaced / kept as is, and its source), which conditional sections (DocFX, terminal-UI captures) were included or skipped, the result of the git check-ignore safety check, and any tracked file under a newly ignored path with the git rm -r --cached it needs.

  • Explicit warnings: review the file before committing; writing .gitignore never untracks committed files (rotate any committed certificate or key); never commit *.pfx or NuGet API keys.

Execution flow

flowchart TD A["Start /iru-setup-dotnet-gitignore"] --> B["Step 0: parse args\n(mode, on-existing)"] B --> C["Step 1: survey docfx.json, solution and projects,\nWindows desktop signals, tracked files, existing .gitignore"] C --> X{"Windows desktop app?"} X -- yes --> Y["Stop: use iru-setup-windows-gitignore"] X -- no --> D{".gitignore exists?"} D -- no --> E["Announce creating from scratch"] D -- yes --> F["Announce updating existing"] E --> G["Step 2: base template\n(bin, obj, artifacts, user state, tests, NuGet, signing, Antora)"] F --> G G --> H["Step 3: DocFX section\nif docfx.json found"] H --> I["Step 4: compose draft, merge existing lines,\ngit check-ignore safety check"] I --> M{"Existing file?"} M -- no --> W["Step 6: write .gitignore"] M -- yes --> N["Step 5: show diff"] N --> O{"on-existing set?"} O -- yes --> P["Apply keep, update or replace"] O -- no --> Q{"AskUserQuestion:\nUpdate, Keep as is, Replace"} P --> W Q -- Update or Replace --> W Q -- Keep as is --> R W --> R["Report mode, action,\nsections, warnings"]

Dependencies

Invokes

None — iru-setup-dotnet-gitignore is a leaf skill; it only reads solution, project and DocFX files, runs read-only git commands, and writes .gitignore. It only points to Setup Windows Gitignore for Windows desktop apps, without calling it.

Invoked by

Also named as a follow-up step by Setup Dotnet Cli when run standalone.

None.

Source

SKILL.md on GitHub — the file this page was generated from.