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

Support for Microsoft.Build.CentralPackageVersions #103

Open
loligans opened this issue Aug 13, 2022 · 4 comments
Open

Support for Microsoft.Build.CentralPackageVersions #103

loligans opened this issue Aug 13, 2022 · 4 comments

Comments

@loligans
Copy link

It would be very nice if completion information could be provided for projects that use: Microsoft.Build.CentralPackageVersions and its Packages.props file.

Project location here: https://github.com/microsoft/MSBuildSdks/tree/main/src/CentralPackageVersions

  • How it works is when you define a: Directory.Build.targets
  • You add the Central Package Management Package to the Directory.Build.targets
<Project>
  <Sdk Name="Microsoft.Build.CentralPackageVersions" Version="2.1.3" />
</Project>
  • Then create a Packages.props
  • Add your packages (Note: the usage of the Update attribute. I am unable to get completion information from this PackageReference when there is no Include attribute. In addition, GlobalPackageReference properties do not provide completions either. As an aside: when I do provide an Include attribute, MSBuild does provide completion information):
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <ItemGroup>
        <GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.5.109" PrivateAssets="all" />
        <PackageReference Update="System.Text.Json" Version="6.0.5" />
    </ItemGroup>

</Project>
  • In your Directory.Build.props or .csproj files, you add your Package Reference (Note: The Version attribute intentionally left out):
    <PackageReference Include="System.Text.Json" />
@tintoy
Copy link
Owner

tintoy commented Aug 13, 2022

Interesting! Yeah I think we could support this (it’d currently ignore any package elements that didn’t match the expected format). I’ll take a look at this tomorrow morning and see what would be involved 🙂

@tintoy
Copy link
Owner

tintoy commented Aug 21, 2022

Still looking into this (sorry, been pretty busy at work this week) 🙂

@loligans
Copy link
Author

No problem, I appreciate you looking into this 😌

@jeroenhabets
Copy link

@tintoy, @loligans Please note that deprecated CentralPackageVersions [1] has been superseded by Central Package Management [2].

Therefore I strongly suggest to add support for Central Package Management and its Directory.Packages.props file.

[1] https://github.com/microsoft/MSBuildSdks/tree/main/src/CentralPackageVersions#deprecated
[2] https://learn.microsoft.com/en-us/nuget/consume-packages/Central-Package-Management

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

3 participants