Skip to content

Use Roslyn from SDK always for SDK-based project builds #48028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Apr 19, 2025

Conversation

jjonescz
Copy link
Member

@jjonescz jjonescz commented Mar 31, 2025

Copy link
Member

@baronfel baronfel left a comment

Choose a reason for hiding this comment

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

Awesome to see this starting!

@jjonescz jjonescz requested a review from jaredpar April 1, 2025 16:53
@jjonescz jjonescz marked this pull request as ready for review April 11, 2025 13:20
@jjonescz jjonescz requested a review from a team as a code owner April 11, 2025 13:20
@jjonescz jjonescz requested a review from jaredpar April 11, 2025 13:20
@baronfel
Copy link
Member

Do we know all of the other tools/products that use Csc to compile things internally? (WPF, Azure Functions, etc) - I'd expect we'd want to make sure that those can conditionally pass the new property if present so make sure that users don't flip between different kinds of compilers in the same logical build.

@jaredpar
Copy link
Member

We know some but don't have a comprehensive list we can consult. Probably should start keeping one as we work through this change during this release

@jaredpar
Copy link
Member

@RikkiGibson, @chsienki PTAL

@jjonescz
Copy link
Member Author

Note that I first need to merge the Roslyn side but waiting for roslyn infra to work again before I do that.

<MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>5.0.0-1.25210.7</MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>
<MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>5.0.0-1.25210.7</MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>5.0.0-1.25210.7</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
<MicrosoftNetCompilersToolsetVersion>4.14.0-3.25210.1</MicrosoftNetCompilersToolsetVersion>
Copy link
Member

Choose a reason for hiding this comment

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

Why are we downgrading the compiler here?

Copy link
Member Author

Choose a reason for hiding this comment

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

This PR needs a corresponding change in Roslyn to flow in first. I built it manually and used it here just temporarily (ie, this will be reverted before merging).

Use Roslyn deployed with SDK for builds of SDK-style projects (regardless of whether the initiator is `dotnet` or `msbuild`).
See https://github.com/dotnet/sdk/blob/main/documentation/general/decouple-vs-and-net-sdk.md.
-->
<Choose>
Copy link
Member

Choose a reason for hiding this comment

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

Consider just making these conditions on the property directly rather than using choose, so you don't have to duplicate the property groups.

Copy link
Member Author

Choose a reason for hiding this comment

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

That would mean needing to duplicate the conditions though and I think that would be less readable.

Comment on lines +74 to +78
// UseSharedCompilation should be the default, so set it only if false.
if (!useSharedCompilation)
{
project.AdditionalProperties["UseSharedCompilation"] = "false";
}
Copy link
Member

Choose a reason for hiding this comment

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

Might be simpler to just always be explicit here:

Suggested change
// UseSharedCompilation should be the default, so set it only if false.
if (!useSharedCompilation)
{
project.AdditionalProperties["UseSharedCompilation"] = "false";
}
project.AdditionalProperties["UseSharedCompilation"] = useSharedCompilation ? "true" : "false";

Copy link
Member

Choose a reason for hiding this comment

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

Which you can probably fold into the initializer above actually

Copy link
Member Author

Choose a reason for hiding this comment

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

My intention is to not set UseSharedCompilation to true, so the tests also verify that true is the default value

@jjonescz jjonescz enabled auto-merge (squash) April 19, 2025 15:32
@jjonescz jjonescz merged commit e5f35a2 into dotnet:main Apr 19, 2025
39 checks passed
@jjonescz jjonescz deleted the core-roslyn branch April 19, 2025 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants