ANcpLua.NET.Sdk.Web
1.1.0
See the version list below for details.
dotnet add package ANcpLua.NET.Sdk.Web --version 1.1.0
NuGet\Install-Package ANcpLua.NET.Sdk.Web -Version 1.1.0
<PackageReference Include="ANcpLua.NET.Sdk.Web" Version="1.1.0" />
<PackageVersion Include="ANcpLua.NET.Sdk.Web" Version="1.1.0" />
<PackageReference Include="ANcpLua.NET.Sdk.Web" />
paket add ANcpLua.NET.Sdk.Web --version 1.1.0
#r "nuget: ANcpLua.NET.Sdk.Web, 1.1.0"
#:package ANcpLua.NET.Sdk.Web@1.1.0
#addin nuget:?package=ANcpLua.NET.Sdk.Web&version=1.1.0
#tool nuget:?package=ANcpLua.NET.Sdk.Web&version=1.1.0
ANcpLua.NET.Sdk
MSBuild SDK with opinionated defaults for .NET projects. Inspired by Meziantou.NET.Sdk.
SDKs
| SDK | Base SDK | Use For |
|---|---|---|
ANcpLua.NET.Sdk |
Microsoft.NET.Sdk |
Libraries, Console Apps, Workers, Unit Tests |
ANcpLua.NET.Sdk.Web |
Microsoft.NET.Sdk.Web |
Web APIs, ASP.NET Core, Integration Tests |
Installation
Replace your SDK reference:
<Project Sdk="ANcpLua.NET.Sdk/1.1.0">
<Project Sdk="ANcpLua.NET.Sdk.Web/1.1.0">
Or use global.json for centralized version management:
{
"msbuild-sdks": {
"ANcpLua.NET.Sdk": "1.1.0",
"ANcpLua.NET.Sdk.Web": "1.1.0"
}
}
Then reference without version:
<Project Sdk="ANcpLua.NET.Sdk">
Working Features
Banned API Analyzer (RS0030)
Enforces best practices via BannedSymbols.txt:
| Banned | Use Instead |
|---|---|
DateTime.Now/UtcNow |
TimeProvider.System.GetUtcNow() |
DateTimeOffset.Now/UtcNow |
TimeProvider.System.GetUtcNow() |
ArgumentNullException.ThrowIfNull |
Native .NET 6+ API (polyfilled) |
Enumerable.Any(predicate) |
List<T>.Exists() |
Enumerable.FirstOrDefault(predicate) |
List<T>.Find() |
InvariantCulture comparisons |
Ordinal |
System.Tuple |
ValueTuple |
Math.Round (no rounding mode) |
Overload with MidpointRounding |
| Local time file APIs | UTC variants |
| Newtonsoft.Json | System.Text.Json |
ANcpLua.Analyzers (Bundled)
| Rule | Description |
|---|---|
| QYL0001 | lock keyword → Use Lock.EnterScope() (.NET 9+) |
| QYL0002 | Deprecated OTel GenAI attributes → Use OTel 1.38 names |
Extensions (Opt-in)
| Property | Description | Default |
|---|---|---|
GenerateClaudeMd |
Auto-generates CLAUDE.md linking to repo root |
false |
InjectSharedThrow |
Injects Throw.IfNull() guard clause helper |
false |
InjectStringOrdinalComparer |
Injects internal StringOrdinalComparer |
false |
InjectFakeLogger |
Injects FakeLoggerExtensions (requires FakeLogCollector) |
false |
InjectSourceGenHelpers |
Injects Roslyn symbol extensions | false |
InjectCommonComparers |
Injects common comparers | false |
EnableANcpLuaExtensions |
Enables all general extensions | false |
EnableANcpLuaSharedResources |
Enables shared engineering resources | false |
EnableANcpLuaSharedWorkflows |
Enables shared workflows | false |
Polyfills (Opt-in for Legacy TFMs)
| Property | Description | Default |
|---|---|---|
InjectLockPolyfill |
Injects System.Threading.Lock (net8.0 backport) |
false |
InjectTimeProviderPolyfill |
Injects System.TimeProvider |
false |
InjectIndexRangeOnLegacy |
Injects Index and Range types |
false |
InjectIsExternalInitOnLegacy |
Injects IsExternalInit (for records) |
false |
InjectTrimAttributesOnLegacy |
Injects trimming attributes (e.g. DynamicallyAccessedMembers) |
false |
InjectNullabilityAttributesOnLegacy |
Injects nullability attributes (e.g. AllowNull) |
false |
InjectRequiredMemberOnLegacy |
Injects RequiredMemberAttribute |
false |
InjectCompilerFeatureRequiredOnLegacy |
Injects CompilerFeatureRequiredAttribute |
false |
InjectCallerAttributesOnLegacy |
Injects CallerArgumentExpressionAttribute |
false |
InjectUnreachableExceptionOnLegacy |
Injects UnreachableException |
false |
InjectExperimentalAttributeOnLegacy |
Injects ExperimentalAttribute |
false |
InjectParamCollectionOnLegacy |
Injects ParamCollectionAttribute |
false |
InjectStackTraceHiddenOnLegacy |
Injects StackTraceHiddenAttribute |
false |
InjectThrowPolyfillsOnLegacy |
Injects C# 14 ThrowPolyfills (extension members) | false |
C# 14 Extension Member Polyfills
Modern throw helpers using C# 14 extension(Type) syntax. Available on all targets:
// .NET 6+ style APIs - work everywhere!
ArgumentNullException.ThrowIfNull(myArg);
ArgumentException.ThrowIfNullOrEmpty(myString);
ArgumentException.ThrowIfNullOrWhiteSpace(myString);
ArgumentOutOfRangeException.ThrowIfNegative(count);
ArgumentOutOfRangeException.ThrowIfZero(count);
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(count);
ArgumentOutOfRangeException.ThrowIfGreaterThan(value, max);
ArgumentOutOfRangeException.ThrowIfLessThan(value, min);
ObjectDisposedException.ThrowIf(isDisposed, this);
Configuration
| Property | Default | Description |
|---|---|---|
GenerateClaudeMd |
false |
Generate CLAUDE.md for AI assistants |
IncludeDefaultBannedSymbols |
true |
Include BannedSymbols.txt |
BannedNewtonsoftJsonSymbols |
true |
Ban Newtonsoft.Json |
EnableDefaultTestSettings |
true |
Auto-configure test runner |
EnableCodeCoverage |
true (CI) |
Enable coverage |
Web Service Defaults (Auto-Registered for Web Projects)
When using Microsoft.NET.Sdk.Web, the SDK automatically adds Aspire 13.0-compatible service defaults:
| Feature | Description |
|---|---|
| OpenTelemetry | Logging, Metrics (ASP.NET, HTTP, Runtime), Tracing with OTLP export |
| Health Checks | /health (readiness) and /alive (liveness) endpoints |
| Service Discovery | Microsoft.Extensions.ServiceDiscovery enabled |
| HTTP Resilience | Standard resilience handlers with retries and circuit breakers |
Opt-out: <AutoRegisterServiceDefaults>false</AutoRegisterServiceDefaults>
License
MIT
Credits
- Inspired by Meziantou.NET.Sdk by Gérald Barré
- ServiceDefaults pattern from .NET Aspire
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.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.6.2 | 29 | 1/10/2026 |
| 1.6.1 | 33 | 1/10/2026 |
| 1.6.0 | 47 | 1/9/2026 |
| 1.5.1 | 65 | 1/8/2026 |
| 1.5.0 | 87 | 1/2/2026 |
| 1.4.2 | 82 | 1/1/2026 |
| 1.4.1 | 83 | 1/1/2026 |
| 1.4.0 | 83 | 1/1/2026 |
| 1.3.31 | 31 | 1/9/2026 |
| 1.3.30 | 35 | 1/9/2026 |
| 1.3.29 | 39 | 1/9/2026 |
| 1.3.28 | 41 | 1/9/2026 |
| 1.3.27 | 35 | 1/9/2026 |
| 1.3.26 | 36 | 1/9/2026 |
| 1.3.25 | 40 | 1/9/2026 |
| 1.3.24 | 46 | 1/9/2026 |
| 1.3.23 | 80 | 1/6/2026 |
| 1.3.22 | 78 | 1/6/2026 |
| 1.3.21 | 79 | 1/6/2026 |
| 1.3.20 | 81 | 1/2/2026 |
| 1.3.19 | 78 | 1/2/2026 |
| 1.3.18 | 83 | 1/1/2026 |
| 1.3.17 | 81 | 1/1/2026 |
| 1.3.16 | 81 | 12/31/2025 |
| 1.3.15 | 82 | 12/31/2025 |
| 1.3.14 | 84 | 12/31/2025 |
| 1.3.13 | 80 | 12/31/2025 |
| 1.3.12 | 81 | 12/31/2025 |
| 1.3.10 | 77 | 12/31/2025 |
| 1.3.9 | 82 | 12/31/2025 |
| 1.3.8 | 86 | 12/30/2025 |
| 1.3.7 | 78 | 12/30/2025 |
| 1.3.6 | 80 | 12/30/2025 |
| 1.3.5 | 86 | 12/30/2025 |
| 1.3.4 | 92 | 12/30/2025 |
| 1.3.3 | 85 | 12/30/2025 |
| 1.3.2 | 84 | 12/30/2025 |
| 1.3.1 | 78 | 12/30/2025 |
| 1.3.0 | 86 | 12/30/2025 |
| 1.2.4 | 91 | 12/29/2025 |
| 1.2.3 | 90 | 12/29/2025 |
| 1.2.2 | 88 | 12/29/2025 |
| 1.2.1 | 183 | 12/25/2025 |
| 1.2.0 | 177 | 12/24/2025 |
| 1.1.8 | 272 | 12/16/2025 |
| 1.1.7 | 261 | 12/16/2025 |
| 1.1.6 | 259 | 12/16/2025 |
| 1.1.5 | 263 | 12/16/2025 |
| 1.1.4 | 263 | 12/16/2025 |
| 1.1.3 | 261 | 12/16/2025 |
| 1.1.2 | 260 | 12/15/2025 |
| 1.1.1 | 240 | 12/15/2025 |
| 1.1.0 | 244 | 12/15/2025 |