-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Describe the bug
When building the C# project at https://github.com/microsoft/qsharp-compiler/blob/main/src/QsCompiler/Tests.LanguageServer/Tests.LanguageServer.csproj against .NET SDK 6.0.202 or 6.0.203, no errors are observed. After updating to .NET SDK 6.0.300 or 7.0.100.preview.3, however, NET1136 is observed during builds:
C:\Program Files\dotnet\sdk\7.0.100-preview.3.22179.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.Defa
ultItems.Shared.targets(250,5): error NETSDK1136: The target platform must be set to Windows (usually by in
cluding '-windows' in the TargetFramework property) when using Windows Forms or WPF, or referencing project
s or packages that do so. [C:\Users\cgran\source\repos\microsoft\qsharp-compiler\src\QsCompiler\Tests.Langu
ageServer\Tests.LanguageServer.csproj]
For example, see CI build output at https://dev.azure.com/ms-quantum-public/Microsoft%20Quantum%20(public)/_build/results?buildId=41360&view=logs&j=89d70cac-d499-5445-3972-d2953f76273e&t=101b9824-70a7-5aa4-254a-0d15cbffbfcd.
To Reproduce
Modify global.json
to the following:
{
"sdk": {
"version": "6.0.300",
"rollForward": "disable"
}
}
Further technical details
➜ dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.203
Commit: a20feadf6d
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22000
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.203\
Host (useful for support):
Version: 7.0.0-preview.3.22175.4
Commit: 162f83657c
.NET SDKs installed:
3.1.201 [C:\Program Files\dotnet\sdk]
3.1.300 [C:\Program Files\dotnet\sdk]
3.1.418 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]
5.0.400 [C:\Program Files\dotnet\sdk]
5.0.407 [C:\Program Files\dotnet\sdk]
6.0.104 [C:\Program Files\dotnet\sdk]
6.0.201 [C:\Program Files\dotnet\sdk]
6.0.202 [C:\Program Files\dotnet\sdk]
6.0.203 [C:\Program Files\dotnet\sdk]
6.0.300 [C:\Program Files\dotnet\sdk]
7.0.100-preview.3.22179.4 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.0-preview.3.22178.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0-preview.3.22175.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.0-preview.3.22177.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
Workaround dotnet/sdk#25363.
ghost commentedon May 11, 2022
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
baronfel commentedon May 11, 2022
I cloned and built the repo, and it turns out that there are two dependencies that you have that are bringing in transitive framework references to Windows frameworks:
I found these by looking at a binlog and cross-referencing with the generated project.assets.json file for the Tests.LanguageServer project. There are a few ways forward that I can see:
DisableTransitiveFrameworkReferences
totrue
, either through the-p
command ofdotnet build
and related commands, or via your project files directlyI do not recommend the third option as a long-term solution, as this will prevent you from restoring any future framework references your dependencies bring in. Right now you have no other dependencies that include framework references, but that could change at any time.
baronfel commentedon May 11, 2022
Interesting note that may need some follow-up - these transitive framework references are as follows:
But the windows-specific frameworkReferences were written to the project.assets.json file under the
net6.0
target node when I would have expected anet6.0-windows10.0.18362
node, or something (I've attached one here as an example). @nkolev92 is this expected? Is there something off with assets file generation here?project.assets.json.zip
cgranade commentedon May 11, 2022
@baronfel: Much obliged for the help! I'll follow up with the package authors, then, as you suggest. Out of curiosity, do you know why these transitive references only started causing a problem as of SDK 6.0.300? Thank you so much!
baronfel commentedon May 11, 2022
I'm unsure - the brief look I've taken shows PRs from a year or two ago, so I would expect it to have been a persistent problem.
nkolev92 commentedon May 12, 2022
@baronfel
Maybe you were looking at the wrong verion of the ImageCatalog package.
I see
Which would explain the assets file.
baronfel commentedon May 12, 2022
Ah, of course! You're exactly right.
baronfel commentedon May 12, 2022
@cgranade the up-shot of @nkolev92's point is that if you update to the most recent version of these libraries (both seem to be 17.2.x versions in the most recent form) then this should go away.
cgranade commentedon May 12, 2022
Much obliged, @baronfel and @nkolev92! Will go on and work with my team to get that updated on our side, then. Thank you again! ♥