Skip to content

Conversation

@jaredpar
Copy link
Member

This changes our RoslynAnalyzers layer to unify on a single version of the Microsoft.CodeAnalysis APIs

This changes our RoslynAnalyzers layer to unify on a single version of the Microsoft.CodeAnalysis APIs
@ghost ghost added Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 29, 2025
<DefineConstants>$(DefineConstants),CODEANALYSIS_V3_7_OR_BETTER</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(MicrosoftCodeAnalysisVersion)' == '' OR $([MSBuild]::VersionNotEquals('$(MicrosoftCodeAnalysisVersion)','1.2.1'))">
<PropertyGroup Condition="'$(MicrosoftCodeAnalysisVersionForAnalyzers)' == '' OR $([MSBuild]::VersionNotEquals('$(MicrosoftCodeAnalysisVersion)','1.2.1'))">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that the min version is 4.0.1 I'm not sure we need this anymore. Could mean we could simplify a bit here.


<DefineConstants Condition="'$(LEGACY_CODE_METRICS_MODE)' == 'true'">$(DefineConstants),LEGACY_CODE_METRICS_MODE</DefineConstants>

<MicrosoftCodeAnalysisVersionForAnalyzer>4.0.1</MicrosoftCodeAnalysisVersionForAnalyzer>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't hate if this was Analyzers instead of Analyzer, but it's basically a change everywhere so certainly not blocking on it.


<!-- RS0026: Avoid public API overloads with differences in optional parameters -->
<NoWarn>$(NoWarn);RS0026</NoWarn>
<MicrosoftCodeAnalysisVersion Condition="'$(MicrosoftCodeAnalysisVersion)' == ''">$(MicrosoftCodeAnalysisVersionForCodeAnalysisAnalyzers)</MicrosoftCodeAnalysisVersion>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is $(MicrosoftCodeAnalysisVersionForCodeAnalysisAnalyzers) defined anywhere?

<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" VersionOverride="$(MicrosoftCodeAnalysisVersionForAnalyzer)" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" VersionOverride="$(MicrosoftCodeAnalysisVersionForAnalyzer)" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" VersionOverride="$(MicrosoftCodeAnalysisVersionForAnalyzer)" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" VersionOverride="$(MicrosoftCodeAnalysisVersionForAnalyzer)" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block should be using MicrosoftCodeAnalysisVersionForAnalyzerTests


<!-- Avoid ID conflicts with the package project. -->
<PackageId>*$(MSBuildProjectFile)*</PackageId>
<MicrosoftCodeAnalysisVersion Condition="'$(MicrosoftCodeAnalysisVersion)' == ''">$(MicrosoftCodeAnalysisVersionForResxSourceGenerators)</MicrosoftCodeAnalysisVersion>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 It would be good to lock this analyzer to an older version, because it doesn't need many APIs, doesn't look at source code, and we want it to work in a wide range of projects.

@JoeRobich JoeRobich closed this pull request by merging all changes into dotnet:main in 790f592 Jun 18, 2025
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jun 18, 2025
@RikkiGibson RikkiGibson modified the milestones: Next, 18.0 P1 Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants