This is a template for a .Net library project. The main idea is to provide convenient preconfigured project structure that would utilize Github Flow for development process and Conventional Commits for semantic versioning and generating a change log.
- GitHub Actions
- When PR is opened, run tests and lint commit messages for Conventional Commits standards
- When PR is merged, run tests, publish to NuGet, update the changelog file and create GitHub release while using GitVersion to figure out the next version. GitVersion is configured to use Conventional Commits to figure out the next release version.
- Preconfigured StyleCop rules
- Pre-Commit configuration and scripts to install the tool and it's hooks
- Scripts to install dependencies so development can be started quicker
- Sample Guard utility class for validation
- .NET SDK as defined in
global.json - PowerShell on Windows for running the helper scripts
- Python for installing and running
pre-commit
- Create a GitHub repository with this project as its template
- Run
install-dependencies(.ps1on Windows or.shon Linux). It installs the right .NET SDK,dotnet-formatand sets uppre-commit - Run the customization script to rename the project and set up placeholders:
- On Linux/macOS:
./customize.sh YourCompanyName YourProjectName - On Windows:
.\customize.ps1 -CompanyName YourCompanyName -ProjectName YourProjectName
- On Linux/macOS:
- Delete the customization scripts (
customize.sh,customize.ps1) if you no longer need them. - Set up NuGet Trusted Publishing (OIDC) in NuGet.org and GitHub. The workflow (
on-merge-pr.yml) is already configured withid-token: writepermissions, so no long-lived API secrets are required! - If you use a different strong name key, update
strongname.snkandAssemblyInfo.csaccordingly
For testing you may want to publish the package without waiting for the merge workflow. Pack and push the project manually:
dotnet pack -c Release
dotnet nuget push "bin/Packages/Release/*.nupkg" -k <API_KEY> -s https://api.nuget.org/v3/index.json