/dotnet_templates

Templates for common files/configs in .NET projects

Primary LanguageNix

Templates for common files/configs in .NET projects. The continuous integration is disabled in this template repository since there is no solution, thus avoiding unnecessary runs.

How to Use This Template

  1. Create a new repository based on this repository:
  • Go to this repository's page, click on the Use this template button and follow instructions.

    OR

  • With GitHub's CLI, run:

    gh repo create NEW_REPOSITORY_NAME --template=dmarcoux/dotnet_templates --clone --private/--public
  1. Search for CHANGEME in the newly created repository to adapt it to the project's needs.

  2. Start the development environment to run the commands from the next steps:

    nix develop
  3. Generate .gitignore from dotnet new and append the content of .gitignore:

    dotnet new gitignore && cat .gitignore.template >> .gitignore && rm .gitignore.template

    Note: By generating .gitignore, we don't have to keep track of the changes in the dotnew new gitignore template.

  4. Generate .editorconfig to follow the default .NET code style:

    dotnet new editorconfig

    Note: By generating .editorconfig, we don't have to keep track of the changes in the dotnew new editorconfig template.

  5. Generate global.json to enforce a specific .NET SDK version with .NET CLI commands and continuous integration.

    just generateGlobalJson

    Note: By generating global.json, we don't have to manually enter the version number of the .NET SDK installed in the development environment.

  6. Adapt this README to the project. This complete section can be deleted...

.NET Development Environment with Nix Flakes

Reproducible development environment for .NET projects which relies on Nix Flakes, a purely functional and cross-platform package manager.

Start development environment:

nix develop

Once inside the development environment...

...launch JetBrains Rider or another IDE:

# Launch JetBrains Rider
just code
# Launch Visual Studio Code
just code code

...or perhaps execute any of the other just recipes/commands included in the justfile:

# List all available just recipes
just

Continuous Integration with GitHub Actions

The continuous integration builds the solution with code analyzers (set in Directory.Build.props), verifies that all code is correctly formatted and runs tests to ensure the codebase stays in a workable state while upholding code quality standards.