Alvecta.Build
1.0.3
dotnet add package Alvecta.Build --version 1.0.3
NuGet\Install-Package Alvecta.Build -Version 1.0.3
<PackageReference Include="Alvecta.Build" Version="1.0.3"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Alvecta.Build" Version="1.0.3" />
<PackageReference Include="Alvecta.Build"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Alvecta.Build --version 1.0.3
#r "nuget: Alvecta.Build, 1.0.3"
#:package Alvecta.Build@1.0.3
#addin nuget:?package=Alvecta.Build&version=1.0.3
#tool nuget:?package=Alvecta.Build&version=1.0.3
Alvecta.Build
Shared build-quality configuration for Alvecta repositories, delivered as a single NuGet
package. Reference it and inherit the standard analyzer + banned-symbol + code-style setup instead
of copy-pasting it into every repo's Directory.Build.props.
Package
| Package | NuGet |
|---|---|
Alvecta.Build |
What you get
Referencing Alvecta.Build gives every C# project in the consuming repo:
- Analyzer packages (as transitive, dev-only dependencies — you don't list them yourself): Roslynator.Analyzers, SonarAnalyzer.CSharp, Microsoft.VisualStudio.Threading.Analyzers, ReferenceTrimmer, Microsoft.CodeAnalysis.BannedApiAnalyzers.
- Analyzer configuration:
AnalysisLevel=latest-recommended,AnalysisMode=Recommended,EnforceCodeStyleInBuild,GenerateDocumentationFile, and the sharedNoWarnlists (including the test-only suppressions, applied automatically to projects whose name ends withTests). - Code-style severities: the
CodeStyle.globalconfig(IDExxxx → warning) andFrameworkAnalyzers.globalconfig(ASP.NET Core / EF Core / Moq severities). - Layered banned-symbol lists (RS0030): base + DateTime bans everywhere, plus opt-out Console and StringBuilder overlays.
Usage
With Central Package Management, add the version once in Directory.Packages.props:
<PackageVersion Include="Alvecta.Build" Version="1.0.*" />
and reference it from every project via the repo's Directory.Build.props:
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
<PackageReference Include="Alvecta.Build" PrivateAssets="all" />
</ItemGroup>
That single reference replaces the analyzer PackageReferences, the GlobalAnalyzerConfigFiles,
the AdditionalFiles banned-symbol wiring, and the analysis/NoWarn properties that used to be
duplicated per repo.
Per-repo knobs
| Property | Effect |
|---|---|
AlvectaAllowConsole=true |
Withholds the Console ban (for CLI / build-tooling projects). |
AlvectaAllowStringBuilder=true |
Withholds the StringBuilder ban (for low-level string-assembly libraries). |
Both default to applying the ban. Scope them per-project with a Condition on
$(MSBuildProjectName), e.g.:
<PropertyGroup Condition="'$(MSBuildProjectName)' == 'Alvecta.ShopifyConnector.Deployment.Cdk'">
<AlvectaAllowConsole>true</AlvectaAllowConsole>
</PropertyGroup>
What stays per-repo (by design)
- Project conventions (
TargetFramework,ImplicitUsings,Nullable,DisableTransitiveProjectReferences): these vary per repo. - The custom
Alvecta.Analyzers*packages and their per-layerApplyPrimitiveObsessionAnalyzer/ApplyValueObjectConstructionAnalyzergating: these key off each repo's project-naming conventions, and bundling them here would create a dependency cycle for theAlvecta.Analyzersrepo itself. Moq+Moq.Analyzers: test tooling that lives next to the repo's other test dependencies.
Versioning
Humans own MAJOR.MINOR (in src/Packaging.props); CI owns the patch (the publish workflow stamps
-p:CiBuildNumber=<run number> on every push to main). Bumping a pinned analyzer version in
src/Directory.Packages.props and cutting a release updates that analyzer everywhere downstream.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.BannedApiAnalyzers (>= 4.14.0)
- Microsoft.VisualStudio.Threading.Analyzers (>= 18.7.23)
- ReferenceTrimmer (>= 3.5.7)
- Roslynator.Analyzers (>= 4.15.0)
- SonarAnalyzer.CSharp (>= 10.27.0.140913)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.