admin管理员组文章数量:1279049
Just in the process of converting our legacy application (.NET 4.8) to use Central Package Management instead of the individual packages.json
files.
I used the .NET Upgrade Assistant for most of the heavy lifting.
Everything appears to have worked correctly. I see the Directory.Packages.props
has been generated in the root (same directory as the solution) of the repository.
All projects (.csproj
) now have the their correct PackageReference
's, e.g.,
<ItemGroup>
<PackageReference Include="System.ValueTuple" />
</ItemGroup>
The generated Directory.Packages.props
has the following structure:
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
</ItemGroup>
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
...Many other package versions
</ItemGroup>
</Project>
Problem
Anytime I add a new Nuget package in Visual Studio via VS Package Manager UI, that package is not being added to the Directory.Packages.props
file. Furthermore the individual PackageReference
added to the project (.csproj
) contain a version.
<PackageReference Include="Humanizer">
<Version>2.14.1</Version>
</PackageReference>
I'm unsure why this new package is not being added to the Directory.Packages.props
file and I also don't understand why the package is being added to the .csproj
with a version.
We're using the following versions:
- Visual Studio 2022 Enterprise v17.11.2
- Nuget 6.11.0
- Installed dotnet version: 8.0.400
All of our C#
projects are targeting .NET Framework 4.8.
Just in the process of converting our legacy application (.NET 4.8) to use Central Package Management instead of the individual packages.json
files.
I used the .NET Upgrade Assistant for most of the heavy lifting.
Everything appears to have worked correctly. I see the Directory.Packages.props
has been generated in the root (same directory as the solution) of the repository.
All projects (.csproj
) now have the their correct PackageReference
's, e.g.,
<ItemGroup>
<PackageReference Include="System.ValueTuple" />
</ItemGroup>
The generated Directory.Packages.props
has the following structure:
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
</ItemGroup>
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
...Many other package versions
</ItemGroup>
</Project>
Problem
Anytime I add a new Nuget package in Visual Studio via VS Package Manager UI, that package is not being added to the Directory.Packages.props
file. Furthermore the individual PackageReference
added to the project (.csproj
) contain a version.
<PackageReference Include="Humanizer">
<Version>2.14.1</Version>
</PackageReference>
I'm unsure why this new package is not being added to the Directory.Packages.props
file and I also don't understand why the package is being added to the .csproj
with a version.
We're using the following versions:
- Visual Studio 2022 Enterprise v17.11.2
- Nuget 6.11.0
- Installed dotnet version: 8.0.400
All of our C#
projects are targeting .NET Framework 4.8.
- i don't think thats supported in framework projects. – Daniel A. White Commented Feb 24 at 0:17
- @DanielA.White I haven't read anything saying it isn't supported. If it's not I'm annoyed that it wasn't explicitly stated anywhere. – WBuck Commented Feb 24 at 12:21
1 Answer
Reset to default 0Unfortunately at the time of this writing (2025-02-24) Central Package Management (CPM) does not support the old style csproj
, so in essence .NET Framework projects are not supported.
[Feature]: Add support for central package management to Visual Studio Package Manager UI for legacy projects
本文标签: cUnable to get Central Package Management (CPM) to work as expectedStack Overflow
版权声明:本文标题:c# - Unable to get Central Package Management (CPM) to work as expected - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741302661a2371182.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论