Setup overview
The following steps will list the actions to setup your project just like the following project template.
Build system
- Create or copy the build system project.
- Setup the build context. Frequent properties to adjust:
- Disable warnings as errors:
context.WarningsAsErrors = false - .NET solution file (if not in
srcfolder):context.DotNetContext.SolutionPath - .NET platform (if not
Any CPU):context.DotNetContext.Platform - .NET test configuration (if not
src/Tests.runsettings):context.DotNetContext.TestConfigPath - .NET code coverage goal:
context.DotNetContext.CoverageTarget = 80 - Define production and preview NuGet feeds for deployment:
context.DotNetContext.PreviewNuGetFeedandcontext.DotNetContext.StableNuGetFeed(default is nuget.org feed)
- Disable warnings as errors:
- Install the external tools or copy the .NET tools manifest:
.config/dotnet-tools.json. - Setup GitVersion via
GitVersion.yml. - Setup GitReleaseManager via
GitReleaseManager.yml. - Update
.gitignoreto ignore build outputs.
.NET projects
- Copy and adapt the file
src/Directory.Build.props. It defines the information for the NuGet packages and SourceLink.- Remove the redundant information from your
.csproj. - Include a README file for your public libraries / tools. In those .csproj,
add
<None Include="../../README.md" Pack="true" PackagePath="$(PackageReadmeFile)" />- If you don't want a README, comment the line tha sets
PackageReadmeFileinDirectory.Build.props
- If you don't want a README, comment the line tha sets
- Include an icon for your public libraries / tools. In those .csproj add
<None Include="../../docs/images/logo_128.png" Pack="true" PackagePath="$(PackageIcon)" Visible="false" />- If you don't define the icon, comment the line tha sets
PackageIconinDirectory.Build.props
- If you don't define the icon, comment the line tha sets
- Remove the redundant information from your
- Follow the format of
src/Directory.Packages.propsto migrate to centralized NuGet packages.- Add each of your dependencies as
PackageVersionand remove the version in each of your.csproj. - You can override a version from a
.csprojwith the attributeVersionOverride.
- Add each of your dependencies as
- If you want code coverage:
- Add a dependency with
coverlet.collectorin your test projects. - Create a file
src/Tests.runsettingsto configure what projects to include / exclude.
- Add a dependency with
- Configure the projects to pack as NuGet by setting
IsPackabletoTruein their .csproj. - Configure the projects to publish in the build system program in
BuildLifetime.Setup()
Documentation
- Create or copy
the DocFX documentation project.
- Our template repository provides some adjustments over the modern template.
- You can include the GitHub icon in the modern template via the
main.jsfile. - Remember to update links in
docfx.jsonand ToC files.
- If you create the project in other folder than
docs/, configure the build context.
Continuous integration
- Copy and adapt the workflow in
.github/workflows. - Create secret variables with the NuGet tokens in the GitHub project settings
- Pass your variable's name in the inputs
nuget_stable_token,nuget_preview_tokenorazure_nuget_token - Review
build.ymlto remove / add OS platforms to run build and tests. - Enable GitHub Pages in the repository settings
- Select GitHub Actions as the source.
- From Environments, select
github-pages. Under Deployment branches and tags add a new rule to allow publishing docs from the tagsv*. - Enable write permissions to publish GitHub Pages. From Actions, "General", go to "Workflow permissions" and ensure it's set to "Read and write permissions".
Collaboration files
- Create project information files:
README.mdLICENSESECURITY.md
- Create community guidelines:
CONTRIBUTING.md: explain how to create issues and pull requests.CODE_OF_CONDUCT.md: GitHub can help to create it.
- Create IDE support files:
.editorconfigand.prettierrc.yaml: code styles and code warnings..vscode/: VS Code support to build, run and debug the project.
- Create templates for GitHub issues / PR:
.github/ISSUE_TEMPLATE/: templates to create GitHub feature requests and bug reports..github/PULL_REQUEST_TEMPLATE.md: Pull Request template.