Templates create compile errors in solutions with Central Package Management (CPM)
See original GitHub issueIs 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
- Create or open a solution with Central Package Management (CPM)
- 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). - 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:
- Created 4 months ago
- Comments:12 (10 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @mkArtakMSFT,
The Template Engine crew is ok with your plans.
@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.