Skip to content

Commit aa68cb3

Browse files
authored
[automated] Merge branch 'release/10.0.1xx' => 'release/10.0.3xx' (#53980)
2 parents 2e9edd8 + 0ec5129 commit aa68cb3

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers.Package.csproj

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@
1717
<GeneratedRulesetsDir>$(BaseOutputPath)Rulesets</GeneratedRulesetsDir>
1818
<GeneratedEditorconfigsDir>$(BaseOutputPath)Editorconfig</GeneratedEditorconfigsDir>
1919
<GeneratedGlobalAnalyzerConfigsDir>$(BaseOutputPath)GlobalAnalyzerConfigs</GeneratedGlobalAnalyzerConfigsDir>
20+
<GeneratedDocumentationDir>$(BaseOutputPath)Documentation</GeneratedDocumentationDir>
21+
<GeneratedSarifFilePath>$(GeneratedDocumentationDir)\$(PackageId).sarif</GeneratedSarifFilePath>
2022
<PackagePropsTargetsFileDir>$(BaseOutputPath)Build</PackagePropsTargetsFileDir>
2123
</PropertyGroup>
2224

25+
<ItemGroup>
26+
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Templating" PrivateAssets="All" />
27+
</ItemGroup>
28+
2329
<ItemGroup>
2430
<AnalyzerNupkgAssembly Include="Microsoft.CodeAnalysis.NetAnalyzers.dll" />
2531
<AnalyzerNupkgAssembly Include="Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll" />
@@ -32,7 +38,7 @@
3238
<None Include="README.md" Pack="true" PackagePath="/documentation" />
3339
<None Include="..\docs\Analyzer Configuration.md" Pack="true" PackagePath="/documentation" />
3440
<None Include="$(PackageId).md" Pack="true" PackagePath="/documentation" />
35-
<None Include="$(PackageId).sarif" Pack="true" PackagePath="/documentation" />
41+
<None Include="$(GeneratedSarifFilePath)" Pack="true" PackagePath="/documentation" Visible="false" />
3642

3743
<None Include="assets\install.ps1" Pack="true" PackagePath="/tools" />
3844
<None Include="assets\uninstall.ps1" Pack="true" PackagePath="/tools" />
@@ -74,6 +80,7 @@
7480
<DisableNETAnalyzersPackagePropsFileName>DisableNETAnalyzersForNuGetPackage.props</DisableNETAnalyzersPackagePropsFileName>
7581
<AnalyzerDocumentationFileName>$(PackageId).md</AnalyzerDocumentationFileName>
7682
<AnalyzerSarifFileName>$(PackageId).sarif</AnalyzerSarifFileName>
83+
<AnalyzerSarifTemplateProperties>AnalyzerVersion=$(VersionPrefix)</AnalyzerSarifTemplateProperties>
7784
<AnalyzerConfigurationFileName>Analyzer Configuration.md</AnalyzerConfigurationFileName>
7885

7986
<!-- Only run validate only in CI builds. Running them in local builds will prevent refreshing auto-generated files. -->
@@ -89,7 +96,13 @@
8996
<_GenerateDocumentationAndConfigFilesPath>%(_GenerateDocumentationAndConfigFilesPath.Identity)</_GenerateDocumentationAndConfigFilesPath>
9097
</PropertyGroup>
9198

99+
<MakeDir Directories="$(GeneratedDocumentationDir)" />
100+
<GenerateFileFromTemplate
101+
TemplateFile="$(AnalyzerSarifFileDir)\$(AnalyzerSarifFileName)"
102+
Properties="$(AnalyzerSarifTemplateProperties)"
103+
OutputPath="$(GeneratedSarifFilePath)" />
104+
92105
<Exec Command='"$(DotNetTool)" "$(_GenerateDocumentationAndConfigFilesPath)" "-validateOnly:$(ValidateOnlyFlag)" "$(GeneratedRulesetsDir)" "$(GeneratedEditorconfigsDir)" "$(GeneratedGlobalAnalyzerConfigsDir)" "$(ArtifactsBinDir)$(EscapeDirectorySuffix)" "$(Configuration)" "$(TargetFramework)" "@(AnalyzerNupkgAssembly)" "$(PackagePropsTargetsFileDir)" "$(PackagePropsFileName)" "$(PackagePropsTargetsFileDir)" "$(PackageTargetsFileName)" "$(DisableNETAnalyzersPackagePropsFileName)" "$(AnalyzerDocumentationFileDir)" "$(AnalyzerDocumentationFileName)" "$(AnalyzerSarifFileDir)" "$(AnalyzerSarifFileName)" "$(VersionPrefix)" $(PackageId) $(ContainsPortedFxCopRules) $(GenerateAnalyzerRulesMissingDocumentationFile) $(ReleaseTrackingOptOut) $(_ValidateOffline)' />
93106
</Target>
94107

95-
</Project>
108+
</Project>

src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers.sarif

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"tool": {
77
"name": "Microsoft.CodeAnalysis.CSharp.NetAnalyzers",
8-
"version": "10.0.300",
8+
"version": "${AnalyzerVersion}",
99
"language": "en-US"
1010
},
1111
"rules": {
@@ -727,7 +727,7 @@
727727
{
728728
"tool": {
729729
"name": "Microsoft.CodeAnalysis.NetAnalyzers",
730-
"version": "10.0.300",
730+
"version": "${AnalyzerVersion}",
731731
"language": "en-US"
732732
},
733733
"rules": {
@@ -6522,7 +6522,7 @@
65226522
{
65236523
"tool": {
65246524
"name": "Microsoft.CodeAnalysis.VisualBasic.NetAnalyzers",
6525-
"version": "10.0.300",
6525+
"version": "${AnalyzerVersion}",
65266526
"language": "en-US"
65276527
},
65286528
"rules": {

src/Microsoft.CodeAnalysis.NetAnalyzers/tools/GenerateDocumentationAndConfigFiles/Program.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public static async Task<int> Main(string[] args)
3232
{
3333
const int expectedArguments = 23;
3434
const string validateOnlyPrefix = "-validateOnly:";
35+
const string analyzerVersionTemplate = "${AnalyzerVersion}";
3536

3637
if (args.Length != expectedArguments)
3738
{
@@ -450,7 +451,9 @@ void createAnalyzerSarifFile()
450451

451452
if (!string.IsNullOrWhiteSpace(analyzerVersion))
452453
{
453-
writer.Write("version", analyzerVersion);
454+
// Keep the checked-in SARIF stable across SDK version updates.
455+
// The build resolves this placeholder into the intermediate output that gets packed.
456+
writer.Write("version", analyzerVersionTemplate);
454457
}
455458

456459
writer.Write("language", culture.Name);

0 commit comments

Comments
 (0)