SvSoft.MSBuild.CheckUnnecessaryUsings
1.0.1
dotnet add package SvSoft.MSBuild.CheckUnnecessaryUsings --version 1.0.1
NuGet\Install-Package SvSoft.MSBuild.CheckUnnecessaryUsings -Version 1.0.1
<PackageReference Include="SvSoft.MSBuild.CheckUnnecessaryUsings" Version="1.0.1" />
paket add SvSoft.MSBuild.CheckUnnecessaryUsings --version 1.0.1
#r "nuget: SvSoft.MSBuild.CheckUnnecessaryUsings, 1.0.1"
// Install SvSoft.MSBuild.CheckUnnecessaryUsings as a Cake Addin #addin nuget:?package=SvSoft.MSBuild.CheckUnnecessaryUsings&version=1.0.1 // Install SvSoft.MSBuild.CheckUnnecessaryUsings as a Cake Tool #tool nuget:?package=SvSoft.MSBuild.CheckUnnecessaryUsings&version=1.0.1
SvSoft.MSBuild.CheckUnnecessaryUsings
Enable the compiler check for unnecessary usings (IDE0005) in CLI builds just by including this package.
<PackageReference Include="SvSoft.MSBuild.CheckUnnecessaryUsings" Version="1.0.0" PrivateAssets="all" />
The package will enforce style checking in the build by setting EnforceCodeStyleInBuild
.
(You may thus get additional non-IDE0005 style-related warnings, depending on your style settings.)
It will also set the diagnostic severity of IDE0005 to warning
for the consuming project via a global analyzer config file.
The severity will be overridden by default by any .globalconfig
file or any other global analyzer config file with a global_level
greater than 10.
Background
There is a long standing issue in Roslyn that prevents the CLI build from checking for unnecessary usings unless XML doc generation is turned on. Yes, I know, crazy. There is a comparatively simple workaround. But it has some disadvantages:
- causes an unwanted and unnecessary potentially empty XML doc file to be included in the output folder
- has to be manually disabled as soon as the project does want real XML doc generation
In contrast, this solution does not leave any unnecessary files in the output folder.
It will also only trigger when GenerateDocumentationFile
is false
(default) in the consuming project.
As soon as XML doc file generation is enabled by setting it to true, the workaround will no longer trigger and thus not have any unwanted side-effects.
In particular, the warnings about missing XML comments (CS1591 and CS1573) will be issued as expected.
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.