FAQ - frequently asked questions
Why do I see the warning "Solution foo.sln is missing an active build configuration for build.csproj"?
- Using NukeExt requires restoring a NuGet package, which Visual Studio and dotnet won't do unless the build.csproj is configured for building. We could simply restore the build.csproj to avoid this, but it's still a poor user experience in Visual Studio, so instead we require enabling it in the .sln.
Why are the Nuke scripts failing to run NuGet restore due to "error: NU1301: Unable to load the service index"?
- This error may occur if dotnet is unable to authenticate to a private NuGet feed. To resolve this:
- Install the Azure Artifacts Credential Provider.
- From PowerShell, run
iex "& { $(irm https://aka.ms/install-artifacts-credprovider.ps1) }"
- From PowerShell, run
- Run
dotnet restore --interactive
, or if you're using our global tools,dotnet tool update -g Microsoft.XboxStudios.NukeTool --version {insert version number here} --interactive
- You may also need the
--verbosity minimal
flag due to an upstream .NET bug. - Consider copying the build.sh and build.ps1 scripts from NukeExt which include these fixes.
- You may also need the
How do I setup Nuke in a different place than the root folder of my Git repository?
- By default the Nuke-generated Azure pipelines build assumes the
build.cmd
script is in the root folder. In case you want to move the Nuke build to a different folder or have multiple builds in one Git repo, you can use a feature specific to NukeExt to set theNukeBuildDirectory
.
How do I integrate Git versioning into my build?
There are two easy ways to use Nerdbank.GitVersioning with Nuke:
- As suggested in the official docs, add a
PackageReference
to your C# project. - In Nuke's
parameters.json
, set theAddGitVersioning
property totrue
- As suggested in the official docs, add a
The tradeoff is generally that option 1 has a greater feature-set, such as the
ThisAssembly
variable, while option 2 is simpler and more reliable. Option 1 works in Visual Studio, but its more complex NuGet package integration has caused issues in our Azure DevOps pipelines.
How do I publish multiple target frameworks, for example net472 and net8.0?
- NUKE supports this out-of-the-box
using
CombineWith
to repeat a target multiple times. For example with cmd:
or PowerShell:sqtech-build.exe --publish-frameworks net8.0 net472
sqtech-build.exe --publish-frameworks @("net8.0", "net472")
How can I verify my build publishes specific files or patterns of files?
- When you're signing your build artifacts, and expecting specific files to be included, NukeExt can check that with its
ValidatePublishOutput
option. For example inparameters.json
, this will validate theartifacts/bin/NukeTool
andNukeTool.DocFX
folders each contain DLL files with any name and also one specific EXE file. Note that only DLL and EXE files are checked, and for greater security you should also enumerate the expected DLL files or file patterns."ValidatePublishOutput": [ "NukeTool: *.dll, NukeTool.exe", "NukeTool.DocFX: *.dll NukeTool.DocFX.exe" ]
How can I run tests with MSTest SDK or MSTest Runner?
- Since .NET now recommends using MSTest SDK instead of NuGet packages,
you can configure Nuke for compatibility with it by setting the
UseTestRunner
parameter to true.- This will adjust the command parameters passed to
dotnet test
to add--
for compatibility, and it will enable coverage collection automatically.
- This will adjust the command parameters passed to
- Starting with .NET 10, it's additionally recommended to use Microsoft.Testing.Platform (MTP) mode
for
dotnet test
. Once you've set up the dotnet.config file, you can configure Nuke to use MTP mode by setting theUseMicrosoftTestingPlatform
parameter to true.- This will adjust the command parameters passed to
dotnet test
to not add--
and also to pass--solution
before the solution file.
- This will adjust the command parameters passed to
- Note if you have an integration test project and are using
TestFilter
to skip those tests in CI, you may need to add a property to the .csproj to avoid failures:<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --ignore-exit-code 8</TestingPlatformCommandLineArguments>
How can I customize the NuGet feed IDs, view IDs, or deployment environment names?
- By default these are controlled by the DeploymentModel setting:
- StudiosQualityTech uses the SQTech.Test (Test environment) and SQTech (Production environment) NuGet feeds
- StudiosQualityTechViewPromotion uses the SQTech feed for Test/Prerelease/Production environments
- XboxStudiosQuality uses the XboxStudios StudiosQuality feed for Test/Prerelease/Production environments
- If you want to customize further, you can set the
NuGetFeeds
parameter like so, where ViewID should be omitted if using unique feed IDs, and the Prerelease environment is also optional."NuGetFeeds": [ "Custom-Test-Environment: FeedID", "Custom-Prerelease-Environment: FeedID/ViewID", "Custom-Production-Environment: FeedID/ViewID", ]
This page was last modified on July 16 2025, 02:55 PM (UTC).