Skip to content
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

Only target NetCurrent for source build #76505

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mthalman
Copy link
Member

The NetCurrent property is the only value that should be targeted in the context of source build. Otherwise, when NetCurrent is net10.0 and NetPrevious is net9.0, you can run into this error when building with the latest .NET 10 SDK build:

/repos/dotnet/.dotnet/sdk/10.0.100-alpha.1.24611.6/Microsoft.Common.CurrentVersion.targets(1889,5): Project '../MSBuild.BuildHost/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.csproj' targets 'net10.0'. It cannot be referenced by a project that targets '.NETCoreApp,Version=v9.0'. [/repos/dotnet/src/roslyn/src/Workspaces/Core/MSBuild/Microsoft.CodeAnalysis.Workspaces.MSBuild.csproj]

Found as part of the work on dotnet/sdk#45435.

@mthalman mthalman requested a review from a team as a code owner December 18, 2024 22:02
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 18, 2024
@ViktorHofer
Copy link
Member

@mthalman this got fixed / worked around with 58d7d7b already.

@mthalman
Copy link
Member Author

mthalman commented Dec 19, 2024

@mthalman this got fixed / worked around with 58d7d7b already.

That doesn't solve the problem. It still attempts to build Microsoft.CodeAnalysis with the net9.0 TFM in a source build configuration which leads to the following errors:

CSC error CS0006: Metadata file '/repos/dotnet/src/roslyn/artifacts/sb/package-cache/microsoft.netcore.app.ref/9.0.0/analyzers/dotnet/cs/Microsoft.Interop.ComInterfaceGenerator.dll' could not be found [/repos/dotnet/src/roslyn/src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj]
CSC error CS0006: Metadata file '/repos/dotnet/src/roslyn/artifacts/sb/package-cache/microsoft.netcore.app.ref/9.0.0/analyzers/dotnet/cs/Microsoft.Interop.LibraryImportGenerator.dll' could not be found [/repos/dotnet/src/roslyn/src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj]
CSC error CS0006: Metadata file '/repos/dotnet/src/roslyn/artifacts/sb/package-cache/microsoft.netcore.app.ref/9.0.0/analyzers/dotnet/cs/Microsoft.Interop.SourceGeneration.dll' could not be found [/repos/dotnet/src/roslyn/src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj]
CSC error CS0006: Metadata file '/repos/dotnet/src/roslyn/artifacts/sb/package-cache/microsoft.netcore.app.ref/9.0.0/analyzers/dotnet/cs/System.Text.Json.SourceGeneration.dll' could not be found [/repos/dotnet/src/roslyn/src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj]
CSC error CS0006: Metadata file '/repos/dotnet/src/roslyn/artifacts/sb/package-cache/microsoft.netcore.app.ref/9.0.0/analyzers/dotnet/cs/System.Text.RegularExpressions.Generator.dll' could not be found [/repos/dotnet/src/roslyn/src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj]

This happens because it's loading the 9.0 targeting back from SBRP which has no analyzers. But the point is, it shouldn't be attempting to target net9.0 in full source build.

roslyn-sb-vmr-binlog.zip

@ViktorHofer
Copy link
Member

ViktorHofer commented Dec 19, 2024

Yes, I agree that when building roslyn from source NetPrevious shouldn't get built. We had a discussion about this in the linked PR and it sounds like others agree on this as well and we should make the change eventually. From the changes in this PR, NetPrevious still gets built. I would expect L57 and L58 to also need to change.

@ViktorHofer ViktorHofer requested a review from jaredpar December 19, 2024 22:04
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.

2 participants