It's a provider hosted project. It used to work until very recently.
If I create a completely new project/solution, then it works.
If I start the old one, or redownload it from source control, I get the following error:
NuGet Package restore failed for project LocalTheaterWeb: Unable to find version '3.0.1' of package 'AppForSharePoint16WebToolkit'
I tried Update-Package -Reinstall
but the problem stays.
Any ideas?
Quick solution for Visual Studio usersSelect the Tools > NuGet Package Manager > Package Manager Settings menu command. Set both options under Package Restore. Select OK. Build your project again.
Restore NuGet packagesNavigate to Tools > Options > NuGet Package Manager > General, and then select the Allow NuGet to download missing packages check box under Package Restore. Enabling Restore NuGet Packages. In Solution Explorer, right-click the solution, and then select Restore NuGet Packages.
Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.
To do that, go to Tools, NuGet Packaged Manager, then go to Package Manager Settings. Go to the General section, and then make sure you have a checkmark for Allow NuGet to download missing packages and also to automatically check for missing packages during the build in Visual Studio.
The solution of Scott Hillier did it for me:
http://www.shillier.com/archive/2014/08/05/nuget-package-restore-fails-for-sharepoint-2013-provider-hosted-apps.aspx
I often take advantage of the NuGet Package Restore capability to reduce the size of my projects when saving or sharing them. Today, I discovered an issue with this process when building SharePoint 2013 Provider-Hosted Apps against SharePoint Online. Here are the steps to reproduce and the fix:
- Create a Provider-Hosted App in Visual Studio 2013 using a SharePoint Online site for debugging.
- Right click solution and "Enable NuGet Package Restore"
- Save and Close Project
- Delete the “packages” folder from project directory
- Open Project in Visual Studio 2013
- Rebuild, receive error “Unable to find AppForSharePoint16WebToolkit”
- Open Packages.config file
- Change “AppForSharePoint16WebToolkit” to “AppForSharePointWebToolkit”
- Rebuild – successfully this time. Apparently, the "AppForSharePoint16WebToolkit" package is not available through the NuGet Package Manager, but the older "AppForSharePointWebToolkit" package is available.
The error message suggests that NuGet cannot find the AppForSharePoint16WebToolkit package in your package sources. So check the following:
Without further information my guess is 3. since you say it works for a new project.
You can also run Fiddler to see what package sources NuGet is using as it tries to restore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With