- Building
- Running tests
- Projects wide configuration
- Deterministic Build configuration
- Source Link configuration
- Repository configuration
- GitHub Workflows
- Release NuGet package
- Clone the repo and open the DotNet.Sdk.Extensions.sln solution file at the root.
- Press build on Visual Studio.
- Clone the repo and browse to the root directory of the repo using your favorite shell.
- Run
dotnet build DotNet.Sdk.Extensions.sln
to build the source for the extensions.
The test projects run against multiple frameworks and the workflow to build and test the solution runs both on Linux and on Windows.
Note
Some tests run a test server with an HTTPS URL so you have to run the following command to trust developer certificates:
dotnet dev-certs https --trust
For more info see Generate self-signed certificates with the .NET CLI.
- Clone the repo and open the DotNet.Sdk.Extensions.sln solution file at the root.
- Go to the test explorer in Visual Studio and run tests.
Note: Remote testing with WSL is configured on the solution which enables you to run the tests locally on Linux via WSL or Docker. You can view the configuration file at testenvironments.json.
To run tests via WSL you need to have at least Visual Studio 2022
and the Linux distro Ubuntu-20.04
installed on WSL.
- Clone the repo and browse to the root directory of the repo using your favorite shell.
- Run
dotnet test DotNet.Sdk.Extensions.sln
to run tests.
-
The Directory.Build.props enables several settings as well as adds some common NuGet packages for all projects.
-
There is a set of NuGet packages that are only applied in test projects by using the condition
"'$(IsTestProject)' == 'true'"
. To make this work thecsproj
for the test projects must have the<IsTestProject>true</IsTestProject>
property defined. Adding this property manually shouldn't be needed because it should be added by theMicrosoft.NET.Test.Sdk
package however there seems to be an issue with this when running tests outside of Visual Studio. See this GitHub issue for more info. -
When running
dotnet
CLI commands make sure you are at the root of the repo so that theglobal.json
is respected. If you don't you might get unexpected results when building the solution. As explained in global.json overview:
The .NET SDK looks for a global.json file in the current working directory (which isn't necessarily the same as the project directory) or one of its parent directories.
Following the guide from Deterministic Builds the ContinuousIntegrationBuild
setting on the Directory.Build.props is set to true, if the build is being executed in GitHub actions.
Following the guide from Source Link the following settings are configured to enable creating Nuget libraries that provide source debugging:
PublishRepositoryUrl
EmbedUntrackedSources
IncludeSymbols
SymbolPackageFormat
These values are configured on the projects that produce NuGet packages:
In addition, as per the documentation, both the above projects include the Microsoft.SourceLink.GitHub
NuGet.
From all the GitHub repository settings the configurations worth mentioning are:
- Automatically delete head branches is enabled: after pull requests are merged, head branches are deleted automatically.
- Branch protection rules. There is a branch protection rule for the the
main
branch that will enforce the following:- Require status checks to pass before merging.
- Require branches to be up to date before merging.
- Require linear history.
For more information about the GitHub workflows configured for this repo go here.
To release a new version of the NuGet packages follow the process described in NuGet release flow.