NetEvolve.Defaults.Analyzer provides several diagnostic analyzers, to improve the nuget package quality and consistency.
$ dotnet add package NetEvolve.Defaults.AnalyzerNetEvolve.Defaults.Analyzer is a comprehensive diagnostic analyzer package that enforces consistent and high-quality NuGet package configurations across your projects. Built on the Roslyn compiler platform, it provides real-time analysis and validation of project file metadata, package properties, and build settings—ensuring that all packable projects meet enterprise-grade quality standards and best practices.
This analyzer package is an integral part of the NetEvolve.Defaults ecosystem and focuses on maintaining consistency and quality in NuGet package configurations. It automatically validates critical aspects of your projects including:
dotnet add package NetEvolve.Defaults.Analyzer
Add the following to your project file (.csproj, .fsproj, or .vbproj):
<PackageReference Include="NetEvolve.Defaults.Analyzer" Version="x.x.x" PrivateAssets="all" />
Note: The attribute is recommended to prevent the analyzer from being included as a transitive dependency in projects that consume your package.
PrivateAssets="all"The analyzer enforces the following diagnostic rules:
| Rule ID | Category | Severity | Description |
|---|---|---|---|
| NED0001 | PackageMetadata | Error | Missing or incomplete <PackageId> tag configuration |
| NED0002 | PackageMetadata | Error | Missing or incomplete <PackageDescription> tag configuration |
| NED0003 | PackageMetadata | Error | Missing or incomplete package <Authors> configuration |
| NED0004 | PackageMetadata | Error | Missing or incomplete package license information |
| NED0005 | PackageMetadata | Error | Missing or incomplete repository URL configuration |
| NED0006 | PackageMetadata | Error | Missing or incomplete issue tracker URL configuration |
| NED0007 | ProjectConfiguration | Error | Missing or incomplete copyright notice configuration |
| NED0008 | ProjectConfiguration | Warning | Project does not follow recommended build configuration patterns |
| NED0009 | ProjectConfiguration | Warning | Missing recommended documentation XML file generation configuration |
| OLD0001 | DeprecatedConfiguration | Warning | Project uses deprecated NetEvolve build configuration patterns |
For detailed information about each rule, including remediation steps and examples, consult the diagnostic documentation.
To ensure optimal analyzer effectiveness for packable projects, configure your project file with:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<!-- Package Metadata -->
<PackageId>Your.Package.Namespace</PackageId>
<PackageVersion>1.0.0</PackageVersion>
<PackageDescription>Brief description of your package's purpose and functionality</PackageDescription>
<Authors>Your Name;Other Contributors</Authors>
<RepositoryUrl>https://github.com/owner/repo</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://github.com/owner/repo</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<BugReportUrl>https://github.com/owner/repo/issues</BugReportUrl>
<Copyright>Copyright (c) 2025 Your Organization. All rights reserved.</Copyright>
</PropertyGroup>
</Project>The analyzer intelligently handles non-packable projects (e.g., test projects, console applications) and provides context-appropriate diagnostics:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPackable>false</IsPackable>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project>This analyzer is designed to complement the NetEvolve.Defaults build configuration package. Together, they provide:
For complete project standardization, install both packages in your projects:
dotnet add package NetEvolve.Defaults
dotnet add package NetEvolve.Defaults.AnalyzerIf you need to suppress a specific diagnostic, use the standard Roslyn suppression mechanism:
#pragma warning disable NED0001
// Code or configuration here
#pragma warning restore NED0001Alternatively, add to your .editorconfig:
[*.csproj]
# Disable specific diagnostics for this project
dotnet_diagnostic.NED0001.severity = noneEnsure the package reference includes PrivateAssets="all":
<PackageReference Include="NetEvolve.Defaults.Analyzer" Version="x.x.x" PrivateAssets="all" />Verify that non-packable projects have <IsPackable>false</IsPackable> set in their project files.
Clean and rebuild your solution:
dotnet clean
dotnet buildThis project is part of the NetEvolve ecosystem. Please refer to the LICENSE file for licensing details.