Templates create compile errors in solutions with Central Package Management (CPM)
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
The project templates always add a `Version` attribute to the `` items in the csproj file. This is an error when [Central Package Management (CPM)](https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management) is enabled.
### Expected Behavior
The project templates should not add a `Version` attribute to the `` items in the csproj file when [Central Package Management (CPM)](https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management) is enabled.
If nesessary, the required `` items should be added to the `Directory.Packages.props` file.
### Steps To Reproduce
1. Create or open a solution with [Central Package Management (CPM)](https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management)
2. Add a new project via one of the project templates that uses `` 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](https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1008)
### Exceptions (if any)
_No response_
### .NET Version
7.0.203
### Anything else?
Using Visual Studio 17.5.5
Related: dotnet/sdk#48903
Contributor guide
Assessment
This issue has not been assessed yet.