NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

New projects using VS Templates should detect CPM in target solution #13810

Open oising opened 2 months ago

oising commented 2 months ago

NuGet Product(s) Involved

Visual Studio Package Management UI

The Elevator Pitch

If I create a new project using an OOTB template in Visual Studio 2022, it fails to take into account solutions that are using Centralized Package Management (CPM.)

I'm not sure how smart this needs to be -- should it scan Directory.Packages.props and look for possible issues (i.e. wanted packages are already there, but are possibly problematic according to semver rules) It seems that some scanning would be required to see if the packages exist or not and if so, are they semver compatible with the desired versions. Then the templates need some metadata associated too. Huh. This is getting complicated :)

Additional Context and Details

No response

oising commented 2 months ago

@davidfowl This makes adding Aspire Orchestrator support to an existing solution via VS very painful too.

JonDouglas commented 2 months ago

@martinrrm / @jeffkl any initial thoughts on making this work w/ cpm-enabled solutions?

jeffkl commented 2 months ago

At the moment, various teams own their templates. We would need to get every single project template owner that uses packages to update their templates. I'm not sure how it would work programmatically to detect if CPM is enabled and such. I think ideally template owners would just specify the list of packages and project system would set them up via APIs that go through a common place that knows if CPM is enabled or not. The biggest involvement would be for project system here, NuGet doesn't actually edit any projects.

jeffkl commented 2 months ago

I'm leaving this open but its sort of a duplicate of https://github.com/dotnet/templating/issues/6187