Skip to content

Conversation

jjonescz
Copy link
Member

Fixes #50419.
Closes #23533 (the tests have been re-enabled).

@jjonescz jjonescz requested review from jaredpar and ericstj August 22, 2025 11:26
@jjonescz jjonescz marked this pull request as ready for review August 22, 2025 12:16
@jjonescz jjonescz requested a review from a team as a code owner August 22, 2025 12:16
@jjonescz jjonescz changed the title Set RoslynAssemblies Set RoslynAssembliesPath Aug 22, 2025
@jjonescz jjonescz requested a review from ericstj August 22, 2025 17:03
@@ -337,8 +337,12 @@ Copyright (c) .NET Foundation. All rights reserved.
</Choose>

Copy link
Member

@ericstj ericstj Aug 22, 2025

Choose a reason for hiding this comment

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

Should we set RoslynAssembliesPath when RoslynCompilerType is not Core as well? That way we establish this as a general contract provided by roslyn/SDK. It's possible that others may wish to use that property.

Copy link
Member Author

Choose a reason for hiding this comment

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

Definitely, that was my intention, thanks.

Copy link
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

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

LGTM. I verified target ordering as well. Had one more small suggestion, but it's non-blocking.

@jjonescz
Copy link
Member Author

I verified target ordering as well.

fwiw, the re-enabled tests would catch the bug (i.e., they fail like in the issue if the product fix is reverted)

@jjonescz
Copy link
Member Author

@jaredpar PTAL

@@ -336,9 +336,15 @@ Copyright (c) .NET Foundation. All rights reserved.
</Otherwise>
</Choose>

<!-- NOTE: Compiler toolset packages should set the following properties on their own, hence we set them only for RoslynCompilerType being Core or Framework. -->
Copy link
Member Author

Choose a reason for hiding this comment

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

📝 I opened a follow-up in roslyn to set RoslynAssembliesPath by the toolset packages as well: dotnet/roslyn#80025

The SDK also sets the following properties:
- `RoslynTargetsPath` to the directory path of the roslyn tasks assembly. This property is used by some targets
but it should be avoided if possible because the tasks assembly name can change as well, not just the directory path.
- `RoslynAssembliesPath` to the directory path of other roslyn assemblies (like `Microsoft.CodeAnalysis.dll`).
Copy link
Member

Choose a reason for hiding this comment

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

@ericstj this value can point to assemblies that target net472 or .NET core. Will the API compat tool be okay with both of these?

Copy link
Member

@ericstj ericstj Aug 25, 2025

Choose a reason for hiding this comment

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

I would expect it to point to the correct framework for the MSBuild host process. So if MSBuild is running as netfx, point to netfx assemblies. If MSBuild is running as core, point to core assemblies.

If you think there is a scenario for cross-framework execution (IE: if MSBuild might allow a core-taskhost in netfx build process the future) then we should also have specific properties that always point at core and netfx.

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently the property should point to the matching TFM assemblies. I can clarify the docs.

Copy link
Member

Choose a reason for hiding this comment

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

Interesting. Why did you pick this? My intuition is that RoslynAssembliesPath would point to the assemblies that would be used by the build task.

Copy link
Member Author

@jjonescz jjonescz Aug 26, 2025

Choose a reason for hiding this comment

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

I picked it so that ApiCompat (currently the only consumer of RoslynAssembliesPath) works. And I would expect other consumers behave similarly in this regard - it's not possible to load netcore MS.CA.dll from custom netfx build task; our bridge compiler build task can work only because it starts an executable; if it loaded roslyn as a library it wouldn't work either. And I assume people will use RoslynAssembliesPath for the library DLLs, not the executables.

@jjonescz jjonescz requested a review from jaredpar August 27, 2025 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants