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                
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="SvSoft.MSBuild.CheckUnnecessaryUsings" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SvSoft.MSBuild.CheckUnnecessaryUsings --version 1.0.1                
#r "nuget: SvSoft.MSBuild.CheckUnnecessaryUsings, 1.0.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.
// 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.

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 (1)

Showing the top 1 popular GitHub repositories that depend on SvSoft.MSBuild.CheckUnnecessaryUsings:

Repository Stars
kitamstudios/rust-analyzer.vs
Rust language support for Visual Studio 2022
Version Downloads Last updated
1.0.1 36,354 8/7/2023
1.0.0 1,635 8/6/2023