SharpDrill.MSBuild 0.5.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package SharpDrill.MSBuild --version 0.5.1
                    
NuGet\Install-Package SharpDrill.MSBuild -Version 0.5.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpDrill.MSBuild" Version="0.5.1">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpDrill.MSBuild" Version="0.5.1" />
                    
Directory.Packages.props
<PackageReference Include="SharpDrill.MSBuild">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SharpDrill.MSBuild --version 0.5.1
                    
#r "nuget: SharpDrill.MSBuild, 0.5.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SharpDrill.MSBuild@0.5.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SharpDrill.MSBuild&version=0.5.1
                    
Install as a Cake Addin
#tool nuget:?package=SharpDrill.MSBuild&version=0.5.1
                    
Install as a Cake Tool

SharpDrill.MSBuild

Reports SharpDrill's exception findings as build warnings after each build: in dotnet build, Visual Studio's Error List and VS Code's Problems panel. Build agents need nothing extra; dotnet restore brings it.

The usual way to run SharpDrill is the SharpDrill tool, in CI or on demand: dotnet sharpdrill exceptions MyApi.slnx --format msbuild prints the same warnings without adding seconds to every build. Use this package when you want them in every build without anyone running the tool.


<ItemGroup>
  <PackageReference Include="SharpDrill.MSBuild" Version="x.y.z" />
</ItemGroup>
Code Finding
SD0001 An exception may escape a controller action: no catch on the way.
SD0002 The same, but a global exception handler (exception middleware or filter) receives it.
SD0003 A throw passes through a try whose catch clauses do not match its type.
SD0004 A third-party call with no catch on the way from the action (only with --strict).
SD0005 An exception leaves an async void method reached from an action: no caller can catch it, so the process ends.
SD0000 The analysis itself failed; build with -v:n to see why.

Each warning points at the throw (SD0001/2/5), the try (SD0003) or the call (SD0004), and names the actions and one example path. Interface and virtual calls are followed into their source implementations; such paths say "possible, not proven".

Suppressing one finding

Use the C# suppression forms where the warning points (the throw, the try or the call):

#pragma warning disable SD0003 // ArgumentException is the only one we can recover from here
try { Load(); } catch (ArgumentException) { }
#pragma warning restore SD0003

[SuppressMessage("SharpDrill", "SD0002:Mapped to 404 by middleware")]
public Order Find(int id) => orders.Get(id) ?? throw new NotFoundException(id);

A pragma covers the code up to its restore (or the end of the file); an attribute covers the method, property or type it is on. Assembly-level [assembly: SuppressMessage] is not read. The build log counts suppressed warnings. If the IDE flags these as unnecessary suppressions (IDE0079), add dotnet_remove_unnecessary_suppression_exclusions = SD0001,SD0002,SD0003,SD0004,SD0005 to .editorconfig.

Settings

<PropertyGroup>
  
  <NoWarn>$(NoWarn);SD0002</NoWarn>
  
  <WarningsAsErrors>$(WarningsAsErrors);SD0001</WarningsAsErrors>
  
  <SharpDrillEnabled Condition="'$(CI)' != 'true'">false</SharpDrillEnabled>
  
  <SharpDrillInput>$(MSBuildThisFileDirectory)../MyApi.slnx</SharpDrillInput>
  
  <SharpDrillArguments>--strict</SharpDrillArguments>
</PropertyGroup>

The analysis loads the whole project graph, so it adds seconds to every build. It does not run during the IDE's background design-time builds, and warnings appear after a build, not while typing. Requires a .NET 10 (or newer) SDK. For the command-line tool, install SharpDrill (dotnet tool install -g SharpDrill). Licensed under MIT.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.9.0 105 11/15/2026
0.8.0 106 11/14/2026
0.7.0 105 11/7/2026
0.6.0 102 11/6/2026
0.5.1 105 11/3/2026
0.5.0 110 11/3/2026