NLua nuget package restore failed in VS 2017 - nuget-package

I am trying to create a .NET 4.6.1 Class Library an use this nuget package with it:
https://www.nuget.org/packages/NLua/
When I click install I get this message:
Package restore failed. Rolling back package changes for 'ClassLibrary1'.
If I try the same install with a web application in the same solution, the install completes successfully.

You are probably creating a "Standard" library, but if you want to add NuGet packages to it then you need to create a "Framework" library. At least that's how I got it to work.

Related

NU1101 Unable to find package DevExpress.ExpressApp.Persistent.Base. No packages exist with this id in source(s):

I am trying to set up packages for a WinForms XAF XPO Standard Security Application.
I used the wizard to create the solution.
Then the project updater
Then I edited the project file package references.
However when I try to build the .exe project I get
NU1101 Unable to find package DevExpress.ExpressApp.Persistent.Base. No packages exist with this id in source(s):
Even though the package shows in the references.
I tried checking the installed packages
For some reason DevExpress.ExpressApp.Persistent.Base was showing in Package Manager as installed in the Module.Win project.
I removed it and now I can build the solution.

Can't install M2MQTT Nuget package to Xamarin.iOS

When installing the Nuget package for M2MQTT 4.3 to my Xamarin.iOS project, I get the following error:
Could not install package 'M2Mqtt 4.3.0'. You are trying to install
this package into a project that targets 'Xamarin.iOS,Version=v1.0',
but the package does not contain any assembly references or content
files that are compatible with that framework.
However, 4.2 works fine. I have seen this error pop up for some other packages too, and my Nuget is up to date. This error shows up when I try to install in VS2017 on Windows and also on Visual Studio for Mac.
Should it be possible to build the package myself from source, and if so, what do I need to change to make it compatible (assuming that the library doesn't actually use part of .NET that Xamarin.iOS doesn't support)?
The reason I need to update is that on 4.2 I get the following error when trying to create a MqttClient:
The type 'IPAddress' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System, Version=3.9.0.0...'
and my hope is that this error will be resolved in the newest version.

Package Manager for VS2012 does not display packages in local feed

I've created a simple package, only consisting of a couple of binaries in the
tools folder. The package is created with NuGet version 4.4.1.4656.
A local folder has been initialized with nuget init and contains said package. VS2017 Package Manager shows the package as expected, whereas VS2012 does not.
There are no available updates for the Package Manager in VS2012, which is at version 2.8.60318.667.
How do I get the feed to work with VS2012, so I can install the package in one of our older solutions? Is this a compatibilty issue?
Any pointers are welcome!

How to upgrade nuget packages if the installed version is missing?

Running into a situation where I deployed an application to production a few months ago and now I need to do some work on it, on an entirely new machine. The first I do is pull source and nuget restore won't restore because it can't find the particular version of the package it was developed under. When I check nuget.org for this package version it is not there. So how do I upgrade my solution to the latest binaries?
Visual Studio 2013 trying to update ServiceStack '4.0.39' to latest, which is '4.0.40' at the time of this post.
Thank you,
Stephen
The best solution I've come up with for this is to manually edit the Packages.config file(s) and set the version number to whatever you want. Restore should then work. It's not a perfect solution but it has dug me out of some holes.
(I know this is an old answer, but it just came up in some Googling)
One issue with the accepted answer (of just updating the version # in packages.config) is that this is just triggering a "package restore"--and will skip any "installation steps" the package might have (things that were done automatically when you first added the package, such as adding assembly references, modifying config files, etc.).
An alternative way would be to edit the packages.config and REMOVE the package in question from there---then start up VS and add the new version. This will trigger the package's usual install routine to do it's thing.
I recommend you to use the NuGet Package Manager Console of Visual Studio:
TOOLS > NuGet Package Manager > Package Manager Console
Command to update a NuGet package to the latest version:
Update-Package ServiceStack
Command to update a NuGet package to a specific version:
Update-Package ServiceStack -version 4.0.40

NuGet Package restore failed for project myProjectWeb: Unable to find version '3.0.1' of package 'AppForSharePoint16WebToolkit'

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?
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:
The correct package source is selected whilst doing the Update-Package -Reinstall.
Check the package source that hosts the NuGet package is enabled. If you are using a recent version of NuGet the package restore should use all the enabled package sources.
See if the solution or project has its own NuGet.config which is overriding the package sources.
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.
For older "locked down" projects with specific package version numbers that you can't update, un-check "Automatically check for missing packages during build in Visual Studio" which is found via:
Nuget Package Manager > Package Manager Settings
This means that if you toggle between newer projects and older projects you need to check and un-check this setting

Resources