Even with Nuget.exe 4.1.0 - Serilog already has a dependency defined for 'Microsoft.CSharp' - visual-studio-2013

I know there's an answer for this question from 2016 but it's not working today. I have VS2013 with the latest CU installed.
My Nuget package source settings:
I want to install the nu-get package "Serilog.Sinks.MSSqlServer". First, I ensure nuget is up to date by navigating to the ".nuget" folder of the solution's folder and running "nuget update -self":
Unfortunately, I still get the error when trying to add the package:
If I try to update nuget from the "Extensions and Updates" page of VS then I get a 403 error as shown below:
The 403 does suggest a proxy issue but other packages can be installed to the same dev box ok. I just installed "Apache log4net" from the Manage NuGet Packages window - no problem
Any ideas of a work-around for this please?

This might be related to the fact that you now (with the new NuGet CLI tool version) need to use the new NuGet API.
from nuget.org
NuGet feed v3 (VS 2015 and later / NuGet v3.x and above): https://api.nuget.org/v3/index.json
NuGet feed v2 (VS 2013 and earlier / NuGet 2.x): https://www.nuget.org/api/v2
You can check (and edit) your NuGet Package Sources under Tools, Options, NuGet Package Manager, Package Sources.
#Rob Bowman, in response to your comment and looking at the screenshot of your Available package sources, try edit your default nuget.org to https://api.nuget.org/v3/index.json or add a new source and make sure they're both enabled. Maybe that'll do the trick.
Update: maybe manually updating the NuGet Package Manager (since updating it through Extensions and Updates is not working) solves the problem. NuGet Package Manager for Visual Studio 2013.
Going to Visual Studio menu Help, About should display the currently installed version of this extension (and others).

To fix this I had to:
logon to a PC not connected to the corporate proxy
download the latest version of the nuget package manager (VSIX) for VS2013 from https://marketplace.visualstudio.com/items?itemName=NuGetTeam.NuGetPackageManagerforVisualStudio2013
copy the VSIX to my corporate dev VM and install

Related

Updating Nuget Package in Visual Studio

I have a problem updating the Nuget packages. I had to install my Visual Studio in a new environment and new is also Azure DevOps. Previously we had the TFS.
Meanwhile I have some packages on the Azure DevOps that I need for my Solution. In addition, packages from Nuget.org are still needed.
In my solution older versions of the Nuget packages are included. Some packages I can't update for some reasons.
Now I have a Nuget package that needs to be updated and here comes my problem. When I go to Tools --> Manage Nuget Package for Solutions... and click on Install, it brings me in the Preview Changes overview all packages that have an older version and wants to update all of them.
Where can I set it or what do I have to do, so that only the one package is updated, which I have selected? In my old environment it works normally.
Thanks.
Cheers
If you want to update one package for all the projects under the solution, you should right-click on the solution-->Manage Nuget Packages for Solution
This will update the package of all selected projects to one same version.
You could also right-click on the project-->Manage nuget packages to update the package one by one. It is definitely not as flexible as the above one .

Global package installation using NuGet

Does NuGet support global package installation like NPM and Composer? If so, how do I do that? Also, how do I reference globally installed packages in my Visual Studio projects?
So learning from #Lance's tips, I went ahead and checked %userprofile%\.nuget\packages folder, and indeed it contains all the packages that I have downloaded in the past. Unfortunately though, Visual Studio (I'm using Community 2019) does not allow you to install any of these packages into a new project. The Browse page in NuGet Package Manager UI displays online results only from nuget.org.
But then I found another clue. In Visual Studio Tools > Options > NuGet Package Manager > Package Sources, you can add custom sources. So I went ahead and added my cache folder as an alternate source.
Note that there is a separate "Machine-wide package sources" entry too that cannot be modified. I checked that folder and it contains mostly Microsoft's own packages (one exception that I found there was NewtonSoft.json). I have no idea how this folder is different from the nuget cache folder and how I can download a package to this folder.
So far so good. The Package Manager now shows all previously downloaded packages from cache when I select this source from the drop down (sources dropdown is in top-right corner). I can then select a package and install it from local source instead of downloading it from the Internet.
Hope this helps someone down the line.

Nuget Cannot find most packages

I've installed Nuget Package Manager for Visual Studio 2015, yet when i try to install most packages I am met with the following error. Any ideas what this issue is would be greatly appreciated...
Your package source, in the drop down at the top left of the Package Manager Console, is currently set to Microsoft and .NET. If you change it to be nuget.org then it should work.
The Microsoft and .NET package source contains the NuGet packages that Microsoft supports which is subset of the packages available from nuget.org.
In Visual Studio go to the Tools -> Options menu, expand NuGet Package Manager, and then click on Package Sources. Ensure "Microsoft and .NET" is checked in the Machine-wide Package list.
When you next start the Package Manager make sure the Package Source dropdown at the top-right has a value selected.

Nuget - Don't see allow nuget to download missing packages during build

I get a message saying the following:
Error 1 Package restore is disabled by default. To give consent, open
the Visual Studio Options dialog, click on Package Manager node and
check 'Allow NuGet to download missing packages during build.' You can
also give consent by setting the environment variable
'EnableNuGetPackageRestore' to 'true'.
When I go to Tools -> Options, I do not see Package Manager and underneath I see Package Sources and Recent Packages. I do not see anywhere where I can set Allow Nuget to download missing packages during build though.
The option to give consent in the UI has been added with NuGet Package Manager 1.8. It's the 3rd item under Tools-> Options-> Package Manager-> General : "Package Restore : Allow NuGet to download missing packages during build".
Please make sure NuGet is up-to-date in Tools->Extension Manager.
Alternatively you can give consent by setting the EnableNuGetPackageRestore Environment variable to true.
I found I needed an extra couple of steps to get it to download the packages
Check Allow NuGet to download missing packages during build
Check Always show solution in Projects and Solutions
Right click on solution and Enable NuGet Package Restore
Open Manage NuGet Packages and click Restore
I did not seem to have the "Package Manager" node under Tools->Options [this was in Visual Studio 2013 :-)]. To get that node in there, I browsed to Tools -> Extensions and Updates and searched for nuget. Installing "NuGet for Visual Studio 2013" got me the node and the option to allow package restore!
I am using Visual Studio 2010 and NuGet 2.0.
Someone had checked in a solution that used NuGet for various packages. When I checked out the solution and built it, I got the same errors. What's more, when I viewed the NuGet Package Manager from the Tools -> Options window, the Package Restore already had the appropriate check boxes checked.
I tried clicking the Clear Package Cache button. After doing that, everything built correctly.

How to manually uninstall a Visual Studio 2010 extension?

So I got prompted to download the latest NuGet Package Manager in VS2010.
All previous updates (including this) has failed with:
VSIXInstaller.SignatureMismatchException: The installed version of 'NuGet Package Manager' is signed, but the update version has an invalid signature. Therefore, Extension Manager cannot install the update.
Which, in itself has been going on for some time now, and they still haven't fixed it (look in Q&A).
Ok, fine, previously I could simply uninstall the NuGet extension and install the latest. However, this time, both the Disable and Uninstall buttons are disabled.
So I can't uninstall and I can't upgrade.
Catch22.
How can I manually remove the NuGet extension from Visual Studio?
What files/folders/reg entries do I have to kill to get rid of NuGet?
To uninstall NuGet, you must first run Visual Studio as Administrator, then you will see the Uninstall option available.
Restart VS, but this time run it as your normal account. When you install NuGet going forward, you should be able to update to future versions without running as Administrator.
I believe this issue occurs due to NuGet being installed with MVC 3. I hope in the future we no longer bundle NuGet with other software.
Maybe this is fixed now. There is a very new release.
http://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c/
http://docs.nuget.org/docs/reference/known-issues#Upgrading_to_latest_NuGet_from_an_older_version_causes_a_signature_verification_error.
When viewing the logs, you might see a mention of a SignatureMismatchException.
To prevent this from occurring, there is a Visual Studio 2010 SP1 hotfix you can install. Alternatively, the workaround is to simply uninstall NuGet and then install it from the VS Extension Gallery. See http://support.microsoft.com/kb/2581019 for more information.
If you want to delete/uninstall Nuget package which is applied to multiple projects in your solutions then go to:
Tools-> Nuget Package Manager -> Manage Nuget Packages for Solution
In the left column where is 'Installed packages' select 'All', so you'll
see a list of installed packages and Manage button across them.
Select Manage button and you'll get a pop out, deselect the checkbox across project name and Ok it
The rest of the work Package Manager will do it for you.

Resources