VisualStudio nuget: Unable to resolve dependency 'Microsoft.Graph.Auth' - visual-studio

When attempting to install a package that has a dependency to Microsoft.Graph.Auth, the nuget package manager in VisualStudio errors with this message:
Unable to resolve dependency 'Microsoft.Graph.Auth'. Source(s) used: 'nuget.org'
No other information is provided.
I can successfully install the Microsoft package manually, however.
The package that depends on the Microsoft package has this in its .nuspec, so as far as I can tell, it should work:
<dependency id="Microsoft.Graph.Auth" version="1.0.0-preview.7" />

I can find it by checking Include prerelease option.

As Per the doc Microsoft.Graph.Auth is deprecated and no longer maintained , either you can try by suggested alternative package Azure.Identity or try by installing via the NuGet package manager console.
NuGet\Install-Package Microsoft.Graph.Auth -Version 1.0.0-preview.7
Thanks

Related

Nuget Visual Studio 2022 control dependency version

Whenever I try to install any package from Nuget through Visual Studio 2022 - be it the GUI or package manager console, I can't seem to find a way to get the highest dependency version.
For example: if I add latest version 1.0.152 protobuf-net.Grpc to my project it has a dependency on Grpc.Core.Api >= 2.36.1. The current version for Grpc.Core.Api is 2.46.3...
In the GUI under options I have no option to control dependency version what so ever it seems like the Install-Package cmdlet doesn't obey -DependencyVersion Highest:
Install-Package protobuf-net.Grpc -DependencyVersion Highest
Installing NuGet package protobuf-net.Grpc 1.0.152.
Committing restore...
Successfully installed 'Grpc.Core.Api 2.36.1'
Successfully installed 'Microsoft.NETCore.Platforms 2.1.0'
Successfully installed 'protobuf-net 2.4.6'
Successfully installed 'protobuf-net.Grpc 1.0.152'
Successfully installed 'System.Memory 4.5.3'
Successfully installed 'System.Private.ServiceModel 4.5.3'
Successfully installed 'System.Reflection.DispatchProxy 4.5.0'
Successfully installed 'System.Security.Principal.Windows 4.5.0'
Successfully installed 'System.ServiceModel.Primitives 4.5.3'
How can I force Nuget to install the highest dependencies version?
According to your description here are some suggestion:
First check your project type “-DependencyVersion Highest” only used in packages.config format.
You can see the project type support about two package management formats: Projects.config and PackageReference.
Someone posted a similar issue on github, see the issue here. Hope this help you.
If you want to use “Grpc.Core.Api 2.46.3 “, you can try to delete the bin and obj folder and then go to Tools>Options>Nuget Package Manager>General>Clear All Nuget Caches.
Then you can install Grpc.Core.Api 2.46.3 package before install protobuf-net.Grpc 1.0.152

Removing a NuGet package that isn't in my project?

I keep getting this warning in my VS2015 solution:
Some NuGet packages were installed using a target framework different from the current target framework and may need to be reinstalled.
The thing is, there are no NuGet packages in my solution. I had one, but I removed it, but I still get this.
Any ideas?
Removing a NuGet package that isn't in my project?
It seems that you have not properly removed that NuGet package.
To resolve this issue, please try to reinstall this package, then uninstall it.
Detailed:
Open the the Package Manager Console by Tools->NuGet Packager Manager->Package Manager Console, and type following command line to reinstall nuget package:
Update-Package -reinstall
After the re-installation is complete, type following command line to uninstall the package in the Package Manager Console:
Uninstall-Package <PackageID>
With this way, the nuget package will be moved from your project. If you have installed that package for multiple project in the solution, please use the uninstall command line for different default project in the Package Manager Console window:
Hope this helps.

Can't install nugget package I made because package is not found

I created a nugget package that contains 5 dll that I want to use as dependencies for some projects. I created a package source to C:\Users\fernane\Desktop\test via Visual Studio so I can select and install my packages from that directory. The package named test 1.4.0.nupkgis in that folder.
The problem I have is that when I try to install said package (test), I get the following error :
Package 'test 1.4.0' is not found in the following primary source(s): 'C:\Users\fernane\Desktop\test'. Please verify all your online package sources are available (OR) package id, version are specified correctly.
I created the package using Nuget Package Explorer.
ID of the package : test
Version : 1.4.0
My question is the following : Why do I get this error and how can I install my package?
Thank you and have a nice day.
My question is the following : Why do I get this error and how can I install my package?
Make sure you've "all" source selected in Package Manager Console and then try update-package command:
Alternatively, you can install that package via Manage NuGet Package UI, Right click your project->Select Manage NuGet Package->change the Package Source to your local feed->find the pacage, install it:

Is there a way to install a NuGet package without all of its dependencies?

In a Visual Studio 2015 C# project, is there any way to selectively install the components of a NuGet package? (Aside from manually adding references)
Background:
I have been using the Microsoft.CodeAnalysis.CSharp package recently. This package contains several libraries that I need:
Microsoft.CodeAnalysis
Microsoft.CodeAnalysis.CSharp
It also installs many libraries that these are dependent on. For the features I am using, I only need these two:
System.Collections.Immutable
System.Reflection.Metadata
But it also installs many more libraries that I never need:
System.AppContext
System.ComponentModel.Composition
System.Console
System.Diagnostics.FileVersionInfo
System.Diagnostics.StackTrace
System.IO.FileSystem
System.IO.FileSystem.Primatives
System.Numerics
System.Security.Cryptography.Algorithms
System.Security.Cryptography.Encoding
System.Security.Cryptography.Primitives
System.Security.Cryptography.X509Certificates
System.Text.Encoding.CodePages
System.Threading.Thread
System.Xml
System.Xml.Linq
System.Xml.XmlDocument
System.Xml.XPath
Systen.Xml.XPath.XDocument
Is there someway I can check the boxes of the libraries I want when installing the package?
According to the docs , there only -IgnoreDependencies command could help us ignore all dependencies. We could not ignore part of dependencies.
But you could implement your requirement with -IgnoreDependencies, please refer to following steps:
Install the Microsoft.CodeAnalysis.CSharp package without any dependence:
Install-Package Microsoft.CodeAnalysis.CSharp -IgnoreDependencies
Install the dependence package Microsoft.CodeAnalysis. Common package without any dependence:
Install-Package Microsoft.CodeAnalysis.Common -IgnoreDependencies
Install the dependence package System.Collections.Immutable and System.Reflection.Metadata package:
Install-Package System.Collections.Immutable
Install-Package System.Reflection.Metadata
If you do not need to use the dependences of “System.Collections.Immutable”and “System.Reflection.Metadata”, you can also use the same option to ignore dependences.

OpenSSL Nuget package not installing in VS 2015

I am trying to install the OpenSSL Nuget package in VS 2015.
I get the error:
Attempting to gather dependencies information for package 'openssl.1.0.2.1' with respect to project 'BLL', targeting '.NETFramework,Version=v4.5'
Package 'openssl' is not found in the following primary source(s): 'https://api.nuget.org/v3/index.json'. Please verify all your online package sources are available.
========== Finished ==========
I also tried running
Install-Package openssl
from the Package Manager Console, but it did not work. It downloaded the "openssl.1.0.2.1.nupkg" file to my packages directory, but there are no other files.
Has anyone else run into this?
The OpenSSL package used for C++ project. And I get the same issue with you when installing the version 1.0.2.1. Then I download the OpenSSL package to local and open it with NuGet Package Explorer, I don't find any content files in this package.
I have submit this issue to OpenSSL package. Please add your comments to this feedback and please waiting response from the owner patiently.
https://github.com/openssl/openssl/issues/1865
But when install the OpenSSL package 1.0.2, it doesn't get any error. So I suggest you install the version 1.0.2 in your project.

Resources