Skip to content

Microsoft.NET.Sdk.WindowsDesktop.props references System.Windows.Controls.Ribbon on .NET 4.0 #255

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

Closed
ericstj opened this issue Jan 11, 2019 · 3 comments · Fixed by #881
Closed
Assignees
Labels
area-infrastructure Bug Product bug (most likely)
Milestone

Comments

@ericstj
Copy link
Member

ericstj commented Jan 11, 2019

Problem description:
When targeting net40 from a WPF app the build emits a warning.

Actual behavior:
Warning:

C:\Program Files\dotnet\sdk\3.0.100-preview-010046\Microsoft.Common.CurrentVersion.targets(2114,5): warning MSB3267: The primary reference "System.Windows.Controls.Ribbon", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "System.Windows.Controls.Ribbon" or retarget your application to a framework version which contains "System.Windows.Controls.Ribbon".

Expected behavior:
No warning

Minimal repro:
dotnet new wpf
change targetframework to net40 or make it cross-target.
dotnet build

(project also attached)
net40.zip

I believe the fix is here is to put a condition on the _SDKImplicitReference items defined in Microsoft.NET.Sdk.WindowsDesktop.props.

Originally reported here: dotnet/core#2085 (comment)

@virzak
Copy link

virzak commented Jan 13, 2019

Same issue with net35

@stevenbrix stevenbrix added this to the 3.0 milestone Apr 4, 2019
@stevenbrix stevenbrix added area-infrastructure Enhancement Requested Product code improvement that does NOT require public API changes/additions labels Apr 4, 2019
@billhenn
Copy link

billhenn commented May 9, 2019

We are beginning to multi-target our WPF control assemblies to net40 and netcoreapp3.0 and are running into this warning now all over the place:

MSB3267 The primary reference "System.Windows.Controls.Ribbon", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "System.Windows.Controls.Ribbon" or retarget your application to a framework version which contains "System.Windows.Controls.Ribbon".

This was originally reported in January and is still occurring in .NET 3.0 preview5. Will it be fixed soon?

@vatsan-madhavan vatsan-madhavan added Bug Product bug (most likely) and removed Enhancement Requested Product code improvement that does NOT require public API changes/additions labels May 9, 2019
@vatsan-madhavan
Copy link
Member

We should definitely fix this before p7. I worry that this will continue to be a big problem for several mainstream scenarios. This is either related to or a duplicate of #327.

/cc @nguerrera, @grubioe, @rladuca

@vatsan-madhavan vatsan-madhavan modified the milestones: 3.0, Preview May 9, 2019
@grubioe grubioe assigned grubioe and vatsan-madhavan and unassigned grubioe May 24, 2019
vatsan-madhavan added a commit that referenced this issue Jun 5, 2019
vatsan-madhavan added a commit that referenced this issue Jun 6, 2019
vatsan-madhavan added a commit that referenced this issue Jun 8, 2019
…priate when targeting net3x and net40 (#881)

* Ensure that implicit references for .NET Framework projects are appropriate when targeting net3x and net40

Fixes #255

* Use $(_TargetFrameworkVersionWithoutV) for exact comparisons.

* Add `$(_MicrosoftNetSdkWindowsDesktop)` . This can be used later in `Microsoft.NET.Sdk` to test whether properties like `UseWpf` or `UseWindowsForms` are set without import `Microsoft.NET.Sdk.WindowsDesktop` and show a warning.
@ghost ghost locked as resolved and limited conversation to collaborators Apr 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-infrastructure Bug Product bug (most likely)
Projects
None yet
6 participants