To restore the state of the dependency, reinstall that specific package. Package update broke the project: If an update to a package breaks a project, the failure is generally caused by a dependency package which may have also been updated.To restore the project, reinstall the affected packages. Project is broken due to deleted files: NuGet does not prevent you from removing items added from packages, so it's easy to inadvertently modify contents installed from a package and break your project.Broken references after package restore: If you've opened a project and restored NuGet packages, but still see broken references, try reinstalling each of those packages.
In a similar scenario, you can restore packages with the dotnet CLI. For a single package, delete the package folder and use nuget install to reinstall the same one.įor the dotnet CLI, the equivalent procedure is not required. Switch to the Browse tab, search for the package name, select it, then select Install).įor all packages, delete the package folder, then run nuget install. On the Installed tab, select a package, record its name, then select Uninstall. On the Updates tab, select one or more packages and select Update Package Manager console (described in Using Update-Package) Updating and reinstalling packages is accomplished as follows: Method In Visual Studio, the Package Manager Console provides many flexible options for updating and reinstalling packages.
Updating a package simply means installing an updated version, which often restores a package to working order. In these cases, uninstalling and then reinstalling the same version of the package will restore those references to working order. There are a number of situations, described below under When to Reinstall a Package, where references to a package might get broken within a Visual Studio project.
PackageReference projects automatically fix broken references when restore is run. The following section applies to nfig based projects only.