NuGet not updating project references

前端 未结 7 1093
鱼传尺愫
鱼传尺愫 2021-02-07 07:29

I recently migrated all my Visual Studio 2013 projects to Visual Studio 2015 and followed the steps documented in this article by Nuget to make sure that automatic package resto

相关标签:
7条回答
  • 2021-02-07 07:39

    None of the above worked for me.

    What did work, was to edit the project file directly and delete the existing reference. When I reloaded the project, the package then showed up in references as a Nuget package.

    0 讨论(0)
  • 2021-02-07 07:45

    So I recently had a very similar issue as well, unfortunately uninstalling and reinstalling did not work. Hopefully this helps anyone else as it was very frustrating.

    Steps:

    1. go to or launch the quick launch feature.
    2. type package manager
    3. select "tools->Nuget PackageManager-> Package Manager Settings"
    4. In the options window that pops up. click "Clear All Nuget Cache(s)"
    5. Right click solution and select Restore Nuget Packages.

    Hope this helps.

    0 讨论(0)
  • 2021-02-07 07:46

    NuGet package restore does not modify the project files. It just downloads and extracts the NuGet packages to the packages directory.

    If you are trying to edit the packages.config file and then have the project's updated you would have to use the Package Manager Console and run:

    Update-Package -reinstall
    

    Which will uninstall and install the packages again and update the project's references.

    0 讨论(0)
  • 2021-02-07 07:48

    I was facing an issue with NuGet package of Newtonsoft.Json as shown below:

    I tried all possible solutions but none of the below mentioned ones worked:

    • Cleaning solution
    • Rebuilding solution
    • Clearing NuGet package cache

    Finally I realized it had something to do with .NET Framework version targeted by my C# project. There was some mismatch it seems. The moment I upgraded the .NET Framework version of my project to latest, the Newtonsoft.Json package dependency and its reference came alive instantly.

    0 讨论(0)
  • 2021-02-07 07:53

    We realized that some of our junior developers only installed the required Nuget packages for ONE project in the solution, they then added references to the required dll's for all other projects by browsing to the physical location of the dll's on disk. This obviously caused the problem because only ONE of the projects in the solution contained entries for Nuget packages in it's packages.config file while the remaining projects in the solution contained none.

    When all packages were updated using the Update-Package command only the ONE project containing entries in it's packages.config file were updated with the correct project references.

    Even though this is not a Nuget bug and rather a problem caused by inexperience, I logged an issue with Nuget to see if they can improve the software to prevent these types of problems.

    0 讨论(0)
  • 2021-02-07 07:57

    Something I just noticed, and I'm not sure if this will help you or anyone else reading this, but this issue literally wracked my brain. The problem was that I was installing packages that I had created myself using NuGet Package Explorer on Windows.

    It turned out that, I believe after updating NuGet Package Explorer, it was no longer putting DLLs that I included into the lib folder. Once I started manually adding the lib folder back into the package within Package Explorer, and then uploading to NuGet and reinstalling in the consuming project, that the reference would once again start to appear.

    I'm not sure what caused this behavior - it could have been my own fault, but I literally just now figured this out - and consequently have to go back and re-do a whole bunch of NuGet package goodness that I've done over the past month. OUCH.

    Hope this saves someone at least an ounce of pain.

    0 讨论(0)
提交回复
热议问题