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

Unexpected build assets picked for net5.0-windows #10418

Closed
huoyaoyuan opened this issue Dec 27, 2020 · 5 comments
Closed

Unexpected build assets picked for net5.0-windows #10418

huoyaoyuan opened this issue Dec 27, 2020 · 5 comments
Assignees
Labels
Functionality:Pack Priority:1 High priority issues that must be resolved in the current sprint.

Comments

@huoyaoyuan
Copy link

Details about Problem

NuGet product used: Visual Studio

VS version (if appropriate): 16.8.3/16.9P2

OS version (i.e. win10 v1607 (14393.321)): 19042

Worked before? N/A

Detailed repro steps so we can see the same problem

Context: dotnet/reactive#1461

Package: System.Reactive 5.0.0

The package structure:

lib\
- (Other frameworks)
- netcoreapp3.1\...
- net5.0\...
- net5.0-windows10.0.19041\...
build\
- netcoreapp3.1\...
- net5.0\...

(no build\net5.0-windows10.0.19041 present)

When installing into net5.0-windows10.0.18362, lib\net5.0 and build\net5.0 are selected, as expected. But when installing into net5.0-windows10.0.19041, lib\net5.0-windows10.0.19041 is selected with build\netcoreapp3.1, results in incompatible behavior. lib\net5.0-windows10.0.19041 is expected to work with build\net5.0.

Please confirm if this is a bug, or a counter-intuitive behavior.

Note: the VS project system UI doesn't show the targets from build\netcoreapp3.1, but displays a warning icon.
WinUI project can only be built with VS build, not dotnet build.

@aortiz-msft aortiz-msft assigned aortiz-msft and zkat and unassigned aortiz-msft Jan 4, 2021
@aortiz-msft aortiz-msft added the Priority:1 High priority issues that must be resolved in the current sprint. label Jan 4, 2021
@aortiz-msft aortiz-msft added this to the Sprint 181 - 2020.12.21 milestone Jan 4, 2021
@zkat zkat modified the milestones: Sprint 181 - 2020.12.21, Sprint 182 - 2021.01.11 Jan 11, 2021
@nkolev92 nkolev92 modified the milestones: Sprint 182 - 2021.01.11, Sprint 182 - 2021.1.11 Jan 11, 2021
@zkat
Copy link
Contributor

zkat commented Jan 16, 2021

This seems to actually be a Pack issue right now?

Looking at the nuspec for System.Reactive:

image

@huoyaoyuan
Copy link
Author

Yes it should be. NuGet Package Explorer doesn't show frameworkReference tag so I didn't mention it.

This looks like to be intentional. They explicit sets UseWPF. But it makes it unusable for WinUI.

Can there be any indications to force net5.0 instead of net5.0-windows10.0.19041 get picked?

@zkat
Copy link
Contributor

zkat commented Jan 23, 2021

Alright, so I'm not really sure where this issue is coming from, but I know it's somewhere in the restore while creating the Reactive package.

I found this in the binlog:

image

Which suggests this is what's causing this to happen:

image

So... this seems to run pretty deep, and the only clue I have at this point is that this is happening through the inclusion of some other package that's forcing it, or it's a bug in dotnet/msbuild or something?

/cc @nkolev92 @zivkan in case this rings a bell and they know how to follow the thread further.

@huoyaoyuan
Copy link
Author

This should be the package requiring reference in unfriendly form. NuGet is working correctly here.

@zivkan
Copy link
Member

zivkan commented Jan 24, 2021

@zkat if you wanted to find where _EnableWindowsDesktopNetCoreFrameworkReferences is being defined, you have a few options:

  1. In the binlog viewer, right click the csproj, and there should be an option similar to "preprocess". This will copy-paste all imported msbuild files into one huge project file, which you can then use any text search
  2. You can generate the preprocess file on the command line as well with msbuild -pp:project.txt or dotnet msbuild -pp:project.txt, then open project.txt in your favorite text editor.
  3. If you feel it's likely that the propery comes from the .NET SDK, rather than a package, you can use your favorite text editor to search the .NET SDK install directory
  4. In this case, _EnableWindowsDesktopNetCoreFrameworkReferences is unique enough such that a GitHub code search uniquely identifies it coming from the dotnet/wpf repo : https://github.com/dotnet/wpf/blob/08c104b43528c7feb646c5094f612556fcdb6dd7/packaging/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.targets#L59-L62

Having frameworkReferences be defined in the package so that consuming projects get it as well made sense in netcoreapp3.1 where there weren't separate TFMs for "desktop" and "console" apps, but it makes less sense with net5.0 and later. On the other hand, perhaps the WPF and WinUI teams need to take this into account and improve their SDKs to take into account how NuGet works and how customers expect to use packages. I don't know if you had intended to follow up with partner teams to improve customer experience, or just trying to figure out if there was a NuGet bug or not. As the customer mentioned, NuGet is working as designed (frameworkReference was designed for .NET Core 3.x).

Can there be any indications to force net5.0 instead of net5.0-windows10.0.19041 get picked?

@huoyaoyuan no, but there's a feature request for this that you could upvote (👍).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Pack Priority:1 High priority issues that must be resolved in the current sprint.
Projects
None yet
Development

No branches or pull requests

6 participants