roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

In RoslynAnalyzers, change Microsoft.CodeAnalysis package references to project references

Open mthalman opened this issue 7 months ago • 2 comments

All of the projects in the src/RoslynAnalyzers directory use PackageReference to reference Microsoft.CodeAnalysis.* when they should really be using ProjectReference since these projects are now in the same repo.

Example:

https://github.com/dotnet/roslyn/blob/c3c7ad6a866dd0b857ad14ce683987c39d2b8fe0/src/RoslynAnalyzers/Microsoft.CodeAnalysis.AnalyzerUtilities/Microsoft.CodeAnalysis.AnalyzerUtilities.csproj#L21

This is needed to correctly resolve an issue with source-build prebuilts: https://github.com/dotnet/dotnet/pull/400#issuecomment-2886950873

/cc @JoeRobich

mthalman avatar May 19 '25 17:05 mthalman

they should really be using ProjectReference since these projects are now in the same repo.

Specifically for source build. For our published packages we still want to reference older packages in order to not tie their usage to the latest Roslyn release.

JoeRobich avatar May 20 '25 20:05 JoeRobich

This issue needs to be fixed before RC1. For source build, we encountered an problem that stems from this issue: https://github.com/dotnet/dotnet/pull/1187#issuecomment-2980464691. It requires us to reboostrap to a newer version of the SDK out of band from a release. This is something that we cannot do once RC1 ships. So in order to avoid that, we need this issue fixed by then.

mthalman avatar Jun 17 '25 14:06 mthalman

@JoeRobich - Is there a timeline for fixing this? It really must be done before RC1.

mthalman avatar Jun 23 '25 19:06 mthalman

@mthalman Is this PR along the lines of what you were thinking? Is there a way to do a test run with these changes?

JoeRobich avatar Jun 24 '25 07:06 JoeRobich

Yes. I'm guessing that there are reasons why this can't be updated to use project references regardless of whether its source build or not?

You can test this by creating a draft PR at https://github.com/dotnet/dotnet, applying your changes to src/roslyn.

mthalman avatar Jun 24 '25 13:06 mthalman

I'm guessing that there are reasons why this can't be updated to use project references regardless of whether its source build or not?

Yes, as these packages also ship via nuget.org, building with project references means our users cannot use these packages with older Roslyn compilers (VS/SDK releases).

JoeRobich avatar Jun 24 '25 13:06 JoeRobich

You can test this by creating a draft PR at https://github.com/dotnet/dotnet, applying your changes to src/roslyn.

It would be neat if there were a GH action that would simplify that to a slash command.

JoeRobich avatar Jun 24 '25 13:06 JoeRobich

You can test this by creating a draft PR at https://github.com/dotnet/dotnet, applying your changes to src/roslyn.

It would be neat if there were a GH action that would simplify that to a slash command.

We're working on getting pipelines available that will allow you to trigger a VMR pipeline run directly from your roslyn repo PR.

mthalman avatar Jun 24 '25 13:06 mthalman