question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Templates create compile errors in solutions with Central Package Management (CPM)

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The project templates always add a Version attribute to the <PackageReference> items in the csproj file. This is an error when Central Package Management (CPM) is enabled.

Expected Behavior

The project templates should not add a Version attribute to the <PackageReference> items in the csproj file when Central Package Management (CPM) is enabled. If nesessary, the required <PackageVersion> items should be added to the Directory.Packages.props file.

Steps To Reproduce

  1. Create or open a solution with Central Package Management (CPM)
  2. Add a new project via one of the project templates that uses <PackageReference> items (e.g. by enabling individual authentication or OpenAPI support for an ASP.NET Core project).
  3. Notice that there are compile errors. The root error is NU1008 Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items

Exceptions (if any)

No response

.NET Version

7.0.203

Anything else?

Using Visual Studio 17.5.5

Related: dotnet/test-templates#300

Issue Analytics

  • State:open
  • Created 4 months ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
YuliiaKovalovacommented, Jun 6, 2023

Hi @mkArtakMSFT,

The Template Engine crew is ok with your plans.

1reaction
cremorcommented, Jun 1, 2023

@YuliiaKovalova I’m not a template author. I initially created this issue in the dotnet/aspnetcore repository. It was specific about the ASP.NET Core project templates. But then it was moved to other repositories, see comments above.

So if you think that this is not a general templating engine issue, then it should be moved back to dotnet/aspnetcore.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Central Package Management
Manage your dependencies in a central location and how you can get started with central package management.
Read more >
Introducing Central Package Management - The NuGet Blog
Central Package Management. Dependency management is a core feature of NuGet. Managing dependencies for a single project can be easy.
Read more >
Simplify NuGet Package Versions in your application with ...
A common problem for multi-project applications, frameworks or libraries is how to manage the versions of NuGet package that are referenced.
Read more >
Why is VS for Mac putting Nuget package version in ...
In the developer community for Visual Studio for Mac there is an open issue that "Central Package Management" (i.e. the Directory.
Read more >
C# package management with NuGet in Visual Studio Code
NuGet in Visual Studio Code. NuGet is the package manager for .NET. It defines how packages for .NET are created, hosted, and consumed, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found