diff --git a/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers.Package.csproj b/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers.Package.csproj index 80f55420cfcb..a403fe040d62 100644 --- a/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers.Package.csproj +++ b/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers.Package.csproj @@ -17,9 +17,15 @@ $(BaseOutputPath)Rulesets $(BaseOutputPath)Editorconfig $(BaseOutputPath)GlobalAnalyzerConfigs + $(BaseOutputPath)Documentation + $(GeneratedDocumentationDir)\$(PackageId).sarif $(BaseOutputPath)Build + + + + @@ -32,7 +38,7 @@ - + @@ -74,6 +80,7 @@ DisableNETAnalyzersForNuGetPackage.props $(PackageId).md $(PackageId).sarif + AnalyzerVersion=$(VersionPrefix) Analyzer Configuration.md @@ -89,7 +96,13 @@ <_GenerateDocumentationAndConfigFilesPath>%(_GenerateDocumentationAndConfigFilesPath.Identity) + + + - \ No newline at end of file + diff --git a/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers.sarif b/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers.sarif index cf84411022e6..8f15c9fb62a1 100644 --- a/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers.sarif +++ b/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers.sarif @@ -5,7 +5,7 @@ { "tool": { "name": "Microsoft.CodeAnalysis.CSharp.NetAnalyzers", - "version": "10.0.202", + "version": "${AnalyzerVersion}", "language": "en-US" }, "rules": { @@ -708,7 +708,7 @@ { "tool": { "name": "Microsoft.CodeAnalysis.NetAnalyzers", - "version": "10.0.202", + "version": "${AnalyzerVersion}", "language": "en-US" }, "rules": { @@ -6503,7 +6503,7 @@ { "tool": { "name": "Microsoft.CodeAnalysis.VisualBasic.NetAnalyzers", - "version": "10.0.202", + "version": "${AnalyzerVersion}", "language": "en-US" }, "rules": { diff --git a/src/Microsoft.CodeAnalysis.NetAnalyzers/tools/GenerateDocumentationAndConfigFiles/Program.cs b/src/Microsoft.CodeAnalysis.NetAnalyzers/tools/GenerateDocumentationAndConfigFiles/Program.cs index ff7104f3fd0a..e631e83ae5b9 100644 --- a/src/Microsoft.CodeAnalysis.NetAnalyzers/tools/GenerateDocumentationAndConfigFiles/Program.cs +++ b/src/Microsoft.CodeAnalysis.NetAnalyzers/tools/GenerateDocumentationAndConfigFiles/Program.cs @@ -32,6 +32,7 @@ public static async Task Main(string[] args) { const int expectedArguments = 23; const string validateOnlyPrefix = "-validateOnly:"; + const string analyzerVersionTemplate = "${AnalyzerVersion}"; if (args.Length != expectedArguments) { @@ -450,7 +451,9 @@ void createAnalyzerSarifFile() if (!string.IsNullOrWhiteSpace(analyzerVersion)) { - writer.Write("version", analyzerVersion); + // Keep the checked-in SARIF stable across SDK version updates. + // The build resolves this placeholder into the intermediate output that gets packed. + writer.Write("version", analyzerVersionTemplate); } writer.Write("language", culture.Name);