lr.Dotnet.Dotfiles 2026.3.24.1720
lr.Dotnet.Dotfiles
NuGet package that deploys standard dotfiles (.gitignore, .gitattributes, .editorconfig, .aiignore, .dockerignore, .stignore) to consuming .NET projects at build time. Uses MSBuild RoslynCodeTaskFactory with smart merge/upsert logic for structured files.
Technology stack
| Technology | Version / Detail |
|---|---|
| Packaging | NuGet package with MSBuild props/targets |
| Build integration | RoslynCodeTaskFactory (inline C# task) |
| Target framework | netstandard2.0 (pack-only, no runtime output) |
| Source control | Azure DevOps (heraeusdigital/lr-Dotnet) |
Getting started
As a consumer
Add the NuGet package reference to your .csproj:
<PackageReference Include="lr.Dotnet.Dotfiles" Version="*" />
Build your project. On first build, the task deploys all dotfiles according to the configured modes.
Configuration
To customize behavior, add a Directory.Build.props in your repository root with the following properties:
<Project>
<PropertyGroup Label="lr.Dotnet.Dotfiles">
<DotnetDotfilesTargetFolder></DotnetDotfilesTargetFolder> <!-- Empty = auto-discover (.git then .sln), or set explicit path -->
<DotnetGitignoreMode>override</DotnetGitignoreMode> <!-- override | createifmissing | never -->
<DotnetGitattributesFileMode>upsert</DotnetGitattributesFileMode> <!-- upsert | never -->
<DotnetGitattributesValueMode>override</DotnetGitattributesValueMode> <!-- override | fill | never -->
<DotnetEditorconfigFileMode>upsert</DotnetEditorconfigFileMode> <!-- upsert | never -->
<DotnetEditorconfigValueMode>override</DotnetEditorconfigValueMode> <!-- override | fill | never -->
<DotnetAiignoreMode>override</DotnetAiignoreMode> <!-- override | createifmissing | never -->
<DotnetDockerignoreMode>override</DotnetDockerignoreMode> <!-- override | createifmissing | never -->
<DotnetStignoreMode>override</DotnetStignoreMode> <!-- override | createifmissing | never -->
</PropertyGroup>
</Project>
Mode reference
Line-based files (.gitignore, .aiignore, .dockerignore, .stignore):
| Mode | Behavior |
|---|---|
| override | Overwrite file with template content |
| createifmissing | Create from template only if file doesn't exist |
| never | Skip entirely |
Key-value files (.gitattributes, .editorconfig):
File mode:
| Mode | Behavior |
|---|---|
| upsert | Create if missing, or merge with existing |
| never | Skip entirely |
Value mode (only applies when file mode = upsert and file already exists):
| Mode | Behavior |
|---|---|
| override | Replace existing values with template values + add missing entries |
| fill | Only add missing entries, don't modify existing values |
| never | Don't add or modify any entries |
Project structure
lr_Dotnet_DotFiles/
├── lr.Dotnet.Dotfiles.csproj # Pack-only project for NuGet packaging
├── lr.Dotnet.Dotfiles.sln # Solution file
├── pack-libs.sh # Builds a versioned .nupkg and pushes to feed
├── azure-pipelines.yml # CI/CD pipeline
├── nuget.config # NuGet feed configuration
├── templates/ # Dotfile templates (packed into NuGet)
│ ├── .gitignore.template
│ ├── .gitattributes.template
│ ├── .editorconfig.template
│ ├── .aiignore.template
│ ├── .dockerignore.template
│ └── .stignore.template
├── msbuild/ # MSBuild integration (packed into build/)
│ ├── lr.Dotnet.Dotfiles.props # Default property values
│ ├── lr.Dotnet.Dotfiles.targets # UsingTask + Target definition
│ └── DeployDotfiles.cs # RoslynCodeTaskFactory task implementation
├── AGENTS.md # AI agent instructions
├── README.md # This file
└── docs/
├── 10_Quickstart.md # Consumer setup guide
├── 20_Deployment.md # NuGet packaging and CI/CD
└── 80_Architecture.md # Architecture overview
Documentation
| Document | Description |
|---|---|
| docs/10_Quickstart.md | Consumer setup, configuration reference, and troubleshooting |
| docs/20_Deployment.md | NuGet packaging, CI/CD pipeline, and versioning |
| docs/80_Architecture.md | MSBuild integration, merge strategies, and design decisions |
Deployment
This project produces a NuGet package. To build and publish:
bash pack-libs.sh
The package is published to the DigitalHubDotnet Azure Artifacts feed. Consuming projects reference it as a standard NuGet dependency.
Contributing
Code style guidelines are defined in AGENTS.md. Key rules:
- Use explicit types (no
var) snake_casefor local variables, method parameters, and constructor argumentsPascalCasefor public properties- Private/protected fields use
snake_casewith leading underscore
No packages depend on lr.Dotnet.Dotfiles.
| Version | Downloads | Last updated |
|---|---|---|
| 2026.3.24.1720 | 2 | 03/24/2026 |
| 2026.3.20.1546 | 69 | 03/20/2026 |
| 2026.3.14.27 | 87 | 03/14/2026 |