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

[CPM] Don't add Package versions when creating a new project if CPM is enabled #12967

Open
adcloeshelle opened this issue Oct 25, 2023 · 4 comments
Assignees
Labels

Comments

@adcloeshelle
Copy link

adcloeshelle commented Oct 25, 2023

NuGet Product(s) Affected

Visual Studio, dotnet.exe

Current Behavior

When you create a new project with certain templates, PackageReferences are added by default. Even if CPM is enabled, the Package version is specified in the PackageReference which leads to a compile error.

Desired Behavior

If CPM is enabled, the package version should not be specified by default.

Additional Context

This allows a developer to create a new project and compile it without any initial errors.

@adcloeshelle adcloeshelle added Triage:Untriaged Type:DCR Design Change Request labels Oct 25, 2023
@kartheekp-ms
Copy link
Contributor

kartheekp-ms commented Oct 26, 2023

I am able to reproduce the issue, and it makes sense to me. The repro steps are simple.

However, my understanding is that new project template implementations are maintained by our partner teams. They leverage the NuGet SDK to add a package reference. @jeffkl, should this request be routed to the project system team? Does the NuGet SDK have any API to identify if the solution has been onboarded onto CPM? If yes, I believe partner teams can leverage the SDK to add the package version to the Directory.Packages.Props file if the solution is already onboarded onto CPM. May be the presence of Directory.Packages.Props is sufficient to ensure that project has been onboarded onto CPM.

I think similar feature requests may arise in the future for dotnet new CLI commands.

@nkolev92
Copy link
Member

nkolev92 commented Oct 27, 2023

There's a duplicating in templating: dotnet/aspnetcore#48569

They have a feature ask for us, but there's some other ways of doing it that are not complete blocked on
#12629

dotnet/templating#6187 (comment)

@nkolev92
Copy link
Member

I think this is more templating work than NuGet, since we don't really control all the templates. The templates themselves add a PackageReference item directly in the project, and that's simply hard to control.

@nkolev92
Copy link
Member

Team Triage: Assigning to @jeffkl to help us better understand the pieces and the ownership of the bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants