Skip to main content
Source: AL0018VersionPropsNotImportedAnalyzer.cs

Description

Version.props should be imported in Directory.Build.props to enable centralized package version management using $(VariableName) syntax.

Bad Code

<!-- Directory.Build.props without Version.props import -->
<Project>
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
  </PropertyGroup>
</Project>

Good Code

<!-- Directory.Build.props with Version.props import -->
<Project>
  <Import Project="Version.props" />
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
  </PropertyGroup>
</Project>

Properties

  • Category: Usage
  • Severity: Warning
  • Enabled by default: True
  • Code fix available: False

Configuration

dotnet_diagnostic.AL0018.severity = warning