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

nbgv tool doesn't support Central Package Management #1031

Open
na1307 opened this issue Feb 20, 2024 · 6 comments
Open

nbgv tool doesn't support Central Package Management #1031

na1307 opened this issue Feb 20, 2024 · 6 comments

Comments

@na1307
Copy link

na1307 commented Feb 20, 2024

nbgv doesn't recognize Directory.Packages.props and CPM.

@KalleOlaviNiemitalo
Copy link

In what way would you want nbgv to recognise those? AFAIK it does not care about NuGet package references at all, so I don't see how the versions of the packages could matter.

@na1307
Copy link
Author

na1307 commented Feb 20, 2024 via email

@KalleOlaviNiemitalo
Copy link

Oh, I see nbgv install adds <PackageReference Include="Nerdbank.GitVersioning" PrivateAssets="all" Version="…" />. Is that the subcommand that should support CPM?

@AArnott
Copy link
Collaborator

AArnott commented Feb 20, 2024

I suspect that's what they're going for, yes. And I use CPM everywhere -- but I don't often use nbgv install, so this slipped my notice.

@na1307
Copy link
Author

na1307 commented Feb 21, 2024

According to the documentation, the version must be omitted in the Build file and PackageVersion must be defined in the Packages file. For example:

Directory.Packages.props:

<Project>
  <PropertyGroup>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
  </PropertyGroup>
  <ItemGroup>
    <PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133" />
  </ItemGroup>
</Project>

Directory.Build.props:

<Project>
  <ItemGroup>
    <PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>
</Project>

@Tjeerd-menno
Copy link

Just add it as a GlobalPackageReference int the Directory.Package.props file. That way there's no need to add anything to the Directory.Build.props.

This is what I use.

image

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

No branches or pull requests

4 participants