Visual Studio/ NuGet missing references

前端 未结 4 1645
有刺的猬
有刺的猬 2021-02-18 23:03

I had some problems with my solution\'s references since somebody went and messed up NuGet... restoring from source control rendered the projects unloadable, and I had to play a

4条回答
  •  不要未来只要你来
    2021-02-18 23:43

    It is not simple but try following steps:

    1. In package manager console restore your nuget packages
    2. Open csproj in notepad and check if paths are correct. If not repair them.
    3. If above steps won`t work in package manager console reinstall all your packages.
    4. If the project is open, Unload it, then Reload it. This forces Visual Studio to re-resolve the references.

    Explanation:

    When nuget add reference it add it in csproj like below:

    
      ..\packages\Newtonsoft.Json.4.5.9\lib\net40\Newtonsoft.Json.dll
    
    

    Which means that package number is in HintPath. After you merge two branches, the nuget version numbers probably changed. This causes that HintPath should also be changed to proper path with version. That is why Visual Studio has problems to find them.

提交回复
热议问题