fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 525 forks source link

Packages are not restored when targeting Windows OS version 10.0.x #4201

Open jbuckmccready opened 1 year ago

jbuckmccready commented 1 year ago

Description

For a windows WPF project changing the target OS version to 10.0.x breaks the restoration process when building using msbuild or dotnet build but I am able to build from Visual Studio 2022 UI. Using only Nuget (no paket) this problem does not occur, everything gets restored and builds properly even when targeting OS version 10.0.x.

Repro steps

Please provide the steps required to reproduce the problem

  1. Set target OS version of the project to 10.0.17763.0 by right clicking the project and selecting properties (or editing the xml). image image
  2. Use paket as normal (create paket.dependencies at root, paket.references for projects, run dotnet paket install).
  3. In Visual Studio 2022 right click project and Build, the packages are restored and build works as expected. Run dotnet build or use the msbuild.exe tool and the restore process produces a project.assets.json file in the obj directory which is missing all the dependencies and the build fails due to missing types/namespaces from dependencies.

I attached a zip file of a minimal project which has the problem: package_restore_silently_fails.zip

I found this issue because the latest version of ReactiveUI only has net6.0-windows10.0.17763 and net7.0-windows10.0.17763 listed under its frameworks. So when I try to build with earlier target OS version it gives a warning about falling back to using the version which targets .NET framework. See related issue here: https://github.com/reactiveui/ReactiveUI/issues/3471

mars888 commented 3 months ago

Seems we are running into the same issue here. When running from the IDE, project.assets.json is generated with all dependencies present and everything builds. When running from the command line, dependencies are missing and the project will fail with missing reference errors.

This project targets net8-windows, uses WPF and ReactiveUI.