Skip to content

[SQLProjects] NuGet restore loop with centrally managed packages #1065

Closed

Description

@codijk

Describe the bug

When updating the CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects package in a Directory.Packages.props file, Visual Studio gets in a nuget restore loop.

A minimal reproduction has been created, which can be found here:
AspireNuGetLoop.zip

Regression

9.9.0 with .NET 9

Steps to reproduce

1. Open the provided solution
2. See the nuget restore loop happen.
3. Move from centrally managed packages to defining them in the CSPROJ directly.
4. Notice that the restore and build succeed.

Expected behavior

Works the same as when not using a Directory.Packages.props file.

Screenshots

Image

IDE and version

Other

IDE version

VS 2026

Nuget packages

CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects (13.0.0)

Additional context

No response

Help us help you

No, just wanted to report this

Activity

  1. codijk commented on Dec 15, 2025

    @codijk
    Author

    I think it goes wrong in this file.

  2. SamuelMcAravey commented on Dec 15, 2025

    @SamuelMcAravey

    @codijk I'm running into the same problem, same version of Visual Studio, and I get build errors complaining about the version of Microsoft.Build, which seems to be pulled in from that same file you indicated. VS 2026 seems to want version 18, and this library is forcing version 17.

    I don't have a fix yet other than removing the reference which isn't great.

  3. ErikEJ commented on Dec 15, 2025

    @ErikEJ
    Contributor

    @SamuelMcAravey That does not sound like the same issue. What makes you think it is?

    If not, please create a new one.

  4. SamuelMcAravey commented on Dec 15, 2025

    @SamuelMcAravey

    @ErikEJ Apologies, I should have explained it a bit better.

    I get the exact same NuGet restore loop error. I just get an extra error talking about the Microsoft.Build package, and those three packages @codijk mentioned (Microsoft.Build, Microsoft.Build.Framework, Microsoft.NET.StringTools) happen to be the packages which get stuck in the loop of restored, removed, restored again. I can see it flicking in and out in Visual Studio, and after it does that a few times I ultimately get the NuGet loop error. That's why I'm thinking it's the same problem, but if they really are different then I'm happy to open a separate issue. Thanks!

  5. ErikEJ commented on Dec 15, 2025

    @ErikEJ
    Contributor

    @SamuelMcAravey Thanks for the additional explanation

  6. codijk commented on Dec 15, 2025

    @codijk
    Author

    @SamuelMcAravey that is exactly what I am seeing as well. Those 3 packages keep being added and removed until the NuGet restore loop error appears.

  7. pheeblyboos commented on Dec 16, 2025

    @pheeblyboos

    I also have exactly the same problem with Aspire projects and this package as described above by @codijk and @SamuelMcAravey using central package management. My VS gets stuck into a loop trying to restore the packages which fails on this project's package and then I get this error.
    It is very blocking for upgrading to .NET 10, I have not been able to find a workaround for this. Trying different package versions together or pinning versions in our own project has not resolved this.

    Image
  8. ErikEJ commented on Jan 5, 2026

    @ErikEJ
    Contributor

    @pheeblyboos
    Workaround:

    <ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>

    @aaronpowell Any ideas how to fix this?

  9. aaronpowell commented on Jan 12, 2026

    @aaronpowell
    Member

    I don't think there's anything we can do in the toolkit to resolve it. My assumption is that it's related to the hack from #949 (comment) that is because the DacFx package is not doing the right thing with the MS Build libraries.

    I'm not sure what to do about it short of trying to find the owners internally at MS

  10. ErikEJ commented on Jan 12, 2026

    @ErikEJ
    Contributor

    @aaronpowell You mean the owners of the DacFX package?

  11. ErikEJ commented on Jan 12, 2026

    @ErikEJ
    Contributor

    @dzsquared It sounds like @aaronpowell has soem ideas how you can fix this in the DacFX package

  12. aaronpowell commented on Jan 12, 2026

    @aaronpowell
    Member

    Oh, I haven't an idea on how to fix it, just that that package is causing the MS Build assembly to be in the output folder which it shouldn't do

  13. ErikEJ commented on Jan 12, 2026

    @ErikEJ
    Contributor

    @aaronpowell I misunderstood your comment here then: #949 (comment)

  14. Odonno commented on Jan 14, 2026

    @Odonno
    Contributor

    Adding a Microsoft.Build reference to the SQL project seems to do the trick.

  15. ErikEJ commented on Jan 14, 2026

    @ErikEJ
    Contributor

    @Odonno What does that reference look like?

  16. 3 remaining items

  17. github-actions commented on Mar 31, 2026

    @github-actions
    Contributor

    We have noticed this issue has not been updated within 21 days. If there is no action on this issue in the next 14 days, we will automatically close it. You can use /stale-extend to extend the window.

  18. ErikEJ commented on Mar 31, 2026

    @ErikEJ
    Contributor

    /stale-extend

  19. github-actions commented on Apr 23, 2026

    @github-actions
    Contributor

    We have noticed this issue has not been updated within 21 days. If there is no action on this issue in the next 14 days, we will automatically close it. You can use /stale-extend to extend the window.

  20. almostchristian commented on Apr 23, 2026

    @almostchristian
    Contributor

    Setting "IsImplicitlyDefined"="true" in the props file would fix this issue. I see that custom SDKs do this and those work with CPM.
    I tried changing the props in my nuget cache and after that I was able to build. It's not a well documented feature.

  21. ErikEJ commented on Apr 23, 2026

    @ErikEJ
    Contributor

    @almostchristian just setting that and no other changes?

  22. ErikEJ commented on Apr 23, 2026

    @ErikEJ
    Contributor

    /stale-extend

  23. almostchristian commented on Apr 23, 2026

    @almostchristian
    Contributor

    yes, I just appended that to the props file, and I'm able to build

    <Project>
      <ItemGroup>
        <PackageReference Include="Microsoft.Build" Version="17.11.48" PrivateAssets="true" ExcludeAssets="all" IsImplicitlyDefined="true" />
        <PackageReference Include="Microsoft.Build.Framework" Version="17.11.48" PrivateAssets="true" ExcludeAssets="all" IsImplicitlyDefined="true" />
        <PackageReference Include="Microsoft.NET.StringTools" Version="17.11.48" PrivateAssets="true" ExcludeAssets="all" IsImplicitlyDefined="true" />
      </ItemGroup>
    </Project>
  24. github-actions commented on May 15, 2026

    @github-actions
    Contributor

    We have noticed this issue has not been updated within 21 days. If there is no action on this issue in the next 14 days, we will automatically close it. You can use /stale-extend to extend the window.

  25. ErikEJ commented on May 15, 2026

    @ErikEJ
    Contributor

    /stale-extend

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions