Source Only package, which provides the standard configurations and settings for the NetEvolve projects. Such as `.editorconfig`, build props and targets.
$ dotnet add package NetEvolve.DefaultsNetEvolve.Defaults is a comprehensive build automation and configuration package that establishes consistent development standards across all NetEvolve projects. It provides standardized configuration files, build properties, analyzer settings, and development guidelines that enforce code quality, consistency, and best practices throughout your project lifecycle.
This package encapsulates enterprise-grade configuration standards including:
.editorconfig)dotnet add package NetEvolve.Defaults
Add the following to your project file (.csproj, .fsproj, or .vbproj):
<PackageReference Include="NetEvolve.Defaults" Version="x.x.x" PrivateAssets="all" />
The PrivateAssets="all" attribute ensures that the defaults package configuration is only applied to your project and not propagated to consumers of your package.
NetEvolve.Defaults automatically configures your project based on its naming conventions and context. All settings can be customized by defining corresponding MSBuild properties in your project file or via the command line.
The build system automatically categorizes projects based on their names:
IsTestableProject)Projects containing .Tests. in their name are automatically identified as testable projects. These projects receive specialized configurations:
Customization:
<PropertyGroup>
<IsTestableProject>true</IsTestableProject>
</PropertyGroup>
IsXampleProject)Projects containing .Xample or starting with Xample. are identified as example/demonstration projects with similar relaxed configurations as test projects.
Customization:
<PropertyGroup>
<IsXampleProject>true</IsXampleProject>
</PropertyGroup>
| Property | Default | Description |
|---|---|---|
LangVersion | latest | C# language version. Set to preview to use preview features. Automatically detected in CI environments. |
Nullable | enable | Enables nullable reference types throughout the project. Highly recommended for C# 8.0+. |
ImplicitUsings | enable | Automatically imports common namespaces (introduced in .NET 6). Reduces boilerplate code. |
WarningLevel | 9999 | Enables all compiler warnings for maximum code quality. |
TreatWarningsAsErrors | true (Release) | In Release builds, compiler warnings are treated as build errors. |
GenerateDocumentationFile | true | Generates XML documentation file from code comments for API documentation. |
RootNamespace | $(MSBuildProjectName) | Default root namespace. Matches the project name by default. |
AssemblyName | $(MSBuildProjectName) | Assembly name. Matches the project name by default. |
NeutralLanguage | en | Default language for satellite assemblies. English (en) is the standard. |
Example:
<PropertyGroup>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
| Property | Default | Description |
|---|---|---|
AnalysisLevel | latest | Roslyn analyzer version. Uses the latest available. |
AnalysisMode | All | Analyzer mode: All, Minimal, or Recommended. All provides comprehensive analysis. |
EnableNETAnalyzers | true | Enables built-in .NET analyzers for modern code pattern detection. |
CodeAnalysisTreatWarningsAsErrors | true | Code analysis warnings are treated as errors in Release builds. |
EnforceCodeStyleInBuild | true | Code style violations (EditorConfig rules) cause build failures. |
ReportAnalyzer | true | Enables analyzer performance reporting during build. |
RunAnalyzersDuringBuild | true | Analyzers run during build operations. |
RunAnalyzersDuringLiveAnalysis | true | Analyzers run during IDE analysis for real-time feedback. |
Features | strict | Enables strict mode for C# language features. |
ErrorLog | diagnostics-{ProjectName}-{TargetFramework}-{Configuration}.sarif | SARIF format error log for analysis integration. |
Example to customize warnings:
<PropertyGroup>
<NoWarn>$(NoWarn);CA1810;CA1031</NoWarn>
</PropertyGroup>
Example to suppress specific warnings in test projects:
<ItemGroup>
<CompilerVisibleProperty Include="IsTestableProject" />
</ItemGroup>
| Property | Default | Description |
|---|---|---|
AccelerateBuildsInVisualStudio | true | Optimizes Visual Studio build performance. |
Deterministic | true (CI only) | Produces identical binaries from identical source across builds. Critical for reproducible builds. |
NetEvolve.Defaults automatically detects CI/CD environments and applies optimization settings:
The package detects execution in the following CI/CD platforms:
GITHUB_ACTIONS)TF_BUILD)GITLAB_CI)JENKINS_URL, BUILD_ID, BUILD_URL)TEAMCITY_VERSION)APPVEYOR)TRAVIS)CIRCLECI)CODEBUILD_BUILD_ID, AWS_REGION)BUILD_ID, PROJECT_ID)JB_SPACE_API_URL)CI)When CI is detected, the following settings are automatically applied:
| Property | Value | Purpose |
|---|---|---|
IsContinuousIntegration | true | Indicates CI environment execution. |
ContinuousIntegrationBuild | true | Enables CI-specific optimizations in the .NET SDK. |
Deterministic | true | Ensures reproducible builds across CI runs. |
RestorePackagesWithLockFile | false | Allows dependency resolution flexibility in CI. |
TreatWarningsAsErrors | true | All warnings must be resolved in CI builds. |
Manual Override:
<PropertyGroup>
<IsContinuousIntegration>true</IsContinuousIntegration>
</PropertyGroup>
For non-test projects built outside Visual Studio, the package is automatically generated during build:
| Property | Default | Description |
|---|---|---|
GeneratePackageOnBuild | true | Automatically creates NuGet package during build (non-test, non-IDE builds). |
Disable package generation:
<PropertyGroup>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup>
| Property | Default | Description |
|---|---|---|
Company | (Not set by defaults) | Company name used in copyright and package metadata. |
CopyrightYearStart | (Current year) | Starting year for copyright notice. Auto-calculated from current year. |
Copyright | Auto-calculated | Copyright notice. Automatically generated as "Copyright @ {Company} {YearStart}" or "Copyright @ {Company} {YearStart} - {CurrentYear}" if years differ. |
Example:
<PropertyGroup>
<Company>NetEvolve</Company>
<CopyrightYearStart>2020</CopyrightYearStart>
</PropertyGroup>
NetEvolve.Defaults includes comprehensive NuGet vulnerability scanning:
| Property | Default | Description |
|---|---|---|
NuGetAudit | true | Enables NuGet security audit checks during restore. |
NuGetAuditMode | all | Audit scope: all (runtime + direct dependencies), direct (direct dependencies only), transitively (transitive dependencies). |
NuGetAuditLevel | low | Minimum severity level: low, moderate, high, critical. |
WarningsAsErrors | NU1900-NU1904 (Release/CI) | Security warnings are treated as errors in Release and CI builds. |
Custom configuration:
<PropertyGroup>
<NuGetAudit>true</NuGetAudit>
<NuGetAuditMode>direct</NuGetAuditMode>
<NuGetAuditLevel>high</NuGetAuditLevel>
</PropertyGroup>
| Property | Default | Description |
|---|---|---|
CheckEolTargetFramework | false (Release) | Suppresses warnings about end-of-life target frameworks in Release builds. |
SuppressTfmSupportBuildWarnings | true (Release) | Suppresses target framework support warnings in Release builds. |
| Property | Default | Description |
|---|---|---|
ErrorLog | diagnostics-{ProjectName}-{TargetFramework}-{Configuration}.sarif | Generates SARIF v2.1 format diagnostic reports for integration with analysis tools. |
ReportAnalyzer | true | Reports analyzer performance metrics during build. |
Example:
<PropertyGroup>
<ErrorLog>custom-diagnostics.sarif</ErrorLog>
</PropertyGroup>
NetEvolve.Defaults supports C# preview features:
<PropertyGroup>
<LangVersion>preview</LangVersion>
</PropertyGroup>
The following warnings are globally suppressed as they conflict with modern C# practices:
Test projects additionally suppress:
Override suppressions:
<PropertyGroup>
<NoWarn>$(NoWarn);CA1234</NoWarn>
</PropertyGroup>
The following warnings are always treated as warnings, never errors:
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Company>YourCompany</Company>
<Description>Your package description</Description>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<IsTestableProject>false</IsTestableProject>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NuGetAudit>true</NuGetAudit>
<NuGetAuditLevel>low</NuGetAuditLevel>
</PropertyGroup>
<PropertyGroup>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<CodeAnalysisTreatWarningsAsErrors>false</CodeAnalysisTreatWarningsAsErrors>
<NuGetAudit>false</NuGetAudit>
</PropertyGroup>
NetEvolve.Defaults includes a comprehensive .editorconfig file that enforces:
The .editorconfig is automatically deployed to your build output and is applied across all supported IDEs and editors.
All NetEvolve.Defaults settings are implemented as MSBuild properties and can be overridden at any level:
dotnet build -p:PropertyName=Value.csproj): <PropertyGroup> elementsDirectory.Build.props: Shared project settingsExample override via command line:
dotnet build -p:TreatWarningsAsErrors=false
NetEvolve.Defaults requires:
No additional NuGet dependencies are introduced to your project.
Disable package information generation:
<PropertyGroup>
<DisableSupportPackageInformation>true</DisableSupportPackageInformation>
</PropertyGroup>
Build diagnostic reports are generated as SARIF files (one per project, target framework, and configuration) for integration with analysis tools and IDE extensions.
Refer to the project's CHANGELOG for version-specific changes and compatibility information.
We welcome contributions! Please ensure all code contributions:
.editorconfig