In my application I'm trying to read XML files and was attempting to use the System.Xml.Linq utilities. I'm using the .net framework 4.6.1 and trying to install the System.Xml.XDocument NuGet package for that purpose.
When I try to install it from the Package Manager, it seems to install correctly (gains the checkmark in the browse tab of manager), but when I check the installed packages, it doesn't show up. I go back to browse on the package manager and it is back to not being installed in my project. I tried installing via the console, but got this error:
Error finding repository for 'https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/': An error occurred while retrieving package metadata for 'System.Xml.XDocument.4.3.0' from source 'Microsoft and .NET'.
A task was canceled.
So I downloaded the NuGet Package from NuGet.org and dumped it in a folder on my computer, tried installing it from there and it seemed to work, the console no longer producing errors, but I was still getting the same behavior in the Package Manager.
I've deleted my project.json.lock file and done a dotnet restore command a few times while trying to figure this out, but I've hit something of a brickwall in what I can do to get this package installed and usable.
In the meantime I've installed and am using the System.Xml.XmlDocument NuGet Package, so at the very least I know I can install other packages.
After working with the member of my team who knows far more about NuGet Packages than I, he pointed it out to me that System.Xml.XDocument isn't supported while using the .Net 4.6.1 Framework. The correct Package to use is/was System.Xml.XPath.XDocument.
Would have been nice to have some indication of that in Package Manager instead of the installed package just uninstalling itself, but That is going to be a marker for me to look for that in the future.
Related
I'm trying to install emgu.CV.runtime.windows from within Visual Studio 2017, and installing by the recommeded method of right-clicking references and installing via NuGet.
However I am getting the error below.
Could not install package 'Emgu.runtime.windows.msvc.rt.x64 19.28.29336'. You are trying to install this package into a project that targets .NETFramework,Version=v4.7.2, but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
According to the package information, its dependencies are
enter code here.NetStandardVersion=2.0
enter code here.Engu.CV (> 4.5.1 && < 4.5.2)
enter code here.Engu.runtime.windows.msvc.rt.x86 (= 19.28.29336)
enter code here.Engu.runtime.windows.msvc.rt.x64 (= 19.28.29336)
I checked and c:\windows\Microsoft.NET\Framework contains a folder for v2.0.50727, so it seem .net 2.0 is installed (as is v3.0, v3.5, v4.0.30319)
I have emgu.CV 4.5.1.4349 installed.
I need this library so that I can have the enter code herebitmap.ToImage<Bgr, byte>(); function.
Why am I getting this error?
Any help would be greatly appreciated.
The solution is migrating from package.config to package references for every project you have. Simply right click on package.config and click "migrate package.config to PackageReference".
Then, install the runtime package again and it will work.
For the new Emgu Nuget package you do need to use PackageReference instead of the traditional package.config.
What worked for me on Visual Studio 2017:
Uninstall all NuGet Packages [This removes the package.config file]
Go to Tools --> Options --> NuGet Package Manager --> General
Change the default package management format to "PackageReference"
Check "allow format selection on first package install"
Click OK
Install Emgu.CV, Emgu.CV.Bitmap, Emgu.CV.UI and Emgu.CV.runtime.windows
These Emgu packages should now appear under your references and you should not see a package.config file.
Nuget Options Image
I encountered the same error. I don't know why we're getting it, but I was able to find a workaround.
Visit the nuget page for the package.
Click "Download Package" to download the nuget package directly.
Open the downloaded file using your archive utility of choice and navigate to the "\runtimes\win-x64\native" folder.
Copy both dll files into the output directory of your project.
After doing this, my code executed without error. Make sure to install emgu.CV.Bitmap as well.
I changed my projects Target Framework to ".NET Framework 4.6" and then went to "Manage NuGet Packages", selected "Browse", typed in "emgu.cv.runtime" then installed version 4.5.1.4349 and it worked.
Here is how I solved it,
1- downgrade .Net framework to 4.6 from project properties
2- Uninstall Emgu.CV and related ones (you will see which ones needed to be uninstalled in Errors List)
3- Install Emgu.CV.runtime.windows from Solution Nuget Manager ( it should install fine now)
3- upgrade .Net framework to 4.8
4- install Emgu.CV 4.5.1 (latest)
5- install Emgu.CV.UI 4.5.1 (Emgu.CV.Bitmwp was installed automatically for me)
and that's it, now you can use bitmap.ToImage<Bgr,Byte>(), note that the Image<Bgr,byte>(bitmap) doesn't work anymore.
I have made Python discord bots in the past with discord.py but now I am learning C# and I want to try to make one with discord.net. When I try to install discord.net - I click on dependencies, then NuGet packages, and then browse and search up discord.net. When I press the install button, I get the following error:
Severity Code Description Project File Line Suppression State
Error Failed to retrieve information about 'Discord.Net.Core' from remote source 'https://github.com/DSharpPlus/DSharpPlus/FindPackagesById()?id='Discord.Net.Core'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
I am using Visual Studio 2019.
The issue is that you have used a private nuget feed. In that feed, you have Discord.Net nuget package but some of its nuget dependencies such as Discord.Net.Core do not exist in your private feed. This is the cause of the problem. Remember that nuget dependencies are installed together with the nuget main package. If there is a problem with installing the dependencies, the main package cannot be installed in the project.
So I suggest you should use nuget.org nuget package source.
Suggestion
1) Tools-->Nuget Package Manager-->Package Manager Settings-->Package Sources
check nuget.org source and if your VS did not have it, you can add like this.
2) then under manage nuget packages UI, please select nuget.org to install that package.
============================================
Update 1
Close VS, delete nuget.config under C:\Users\xxx(current user)\AppData\Roaming\NuGet.
Then, restart VS and then installing nuget packages work well.
Microsoft.EntityFrameworkCore not installing and hanging when I am trying to install 2.2.6 into my main project and a new C# .NET core project:
Restoring packages for C:\Repos\SnowdonAPI_02\SnowdonAPI_02\SnowdonAPI_02\SnowdonAPI_02.csproj...
GET https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.abstractions/index.json
GET https://api.nuget.org/v3-flatcontainer/microsoft.extensions.options/index.json
GET https://api.nuget.org/v3-flatcontainer/microsoft.extensions.configuration.binder/index.json
GET https://api.nuget.org/v3-flatcontainer/system.interactive.async/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.abstractions/index.json 253ms
OK https://api.nuget.org/v3-flatcontainer/microsoft.extensions.options/index.json 146ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.abstractions/2.2.6/microsoft.entityframeworkcore.abstractions.2.2.6.nupkg
GET https://api.nuget.org/v3-flatcontainer/microsoft.extensions.options/2.2.0/microsoft.extensions.options.2.2.0.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.extensions.configuration.binder/index.json 321ms
OK https://api.nuget.org/v3-flatcontainer/system.interactive.async/index.json 343ms
OK https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.abstractions/2.2.6/microsoft.entityframeworkcore.abstractions.2.2.6.nupkg 203ms
OK https://api.nuget.org/v3-flatcontainer/microsoft.extensions.options/2.2.0/microsoft.extensions.options.2.2.0.nupkg 189ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.extensions.configuration.binder/2.2.0/microsoft.extensions.configuration.binder.2.2.0.nupkg
GET https://api.nuget.org/v3-flatcontainer/system.interactive.async/3.2.0/system.interactive.async.3.2.0.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.extensions.configuration.binder/2.2.0/microsoft.extensions.configuration.binder.2.2.0.nupkg 19ms
OK https://api.nuget.org/v3-flatcontainer/system.interactive.async/3.2.0/system.interactive.async.3.2.0.nupkg 30ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.extensions.configuration/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.extensions.configuration/index.json 110ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.extensions.configuration/2.2.0/microsoft.extensions.configuration.2.2.0.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.extensions.configuration/2.2.0/microsoft.extensions.configuration.2.2.0.nupkg 13ms
Installing Microsoft.Extensions.Configuration 2.2.0.
Installing Microsoft.Extensions.Configuration.Binder 2.2.0.
Installing Microsoft.Extensions.Options 2.2.0.
Installing System.Interactive.Async 3.2.0.
Installing Microsoft.EntityFrameworkCore.Abstractions 2.2.6.
It gets as far as here and doesn't go any further. I then have to force quit visual studio.
According to your logs, maybe something interrupts the installation during the process.
Normally the possible cause of the issue can be: something broken in VS Itself, or one effect of extension, wrong action when installing the packages or nuget configurations.
I can't get the workaround which surely resolve your issue for the lack of detailed info, but there's some tips you can try:
1.Extensions=>Manage Extensions=>Disable them and restart VS to take effect
2.Update VS2019 to latest version, if it's the latest one, run a vs repair
3.Make sure your project targets .net core 2.2 and install the Microsoft.EntityFrameworkCore separately. It seems the nuget try to install the five packages at one time but as I know the Microsoft.EntityFrameworkCore doesn't depend on the other packages, so I'm not sure what the way you mean when I am trying to install 2.2.6 into my main project, more details is needed so that we can understand why installing the package Microsoft.EntityFrameworkCore causes installing the other four packages.
For this, please create a new asp.net core web-api project, and install the 2.2.6-version Microsoft.EntityFrameworkCore package by UI, check if the issue persists. If it persists, clear the nuget cache and delete the bin and obj folders, then restore packages for the new project by UI.
After you clean the cache, go C:\Users\xxx\.nuget\packages(This folder is used to store packages for those projects with packageReference format), now this folder is empty. Check if the nuget is really installing when you restore packages in VS. (If it really starts installing the package, the folder won't be empty after that)
4.For the packages it tried to install like Microsoft.Extensions.Configuration.Binder 2.2.0: It's strange behavior I think. Check the properties window for this package and I found its path is C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.extensions.configuration.binder\2.2.0, so it's part of .net sdk I think. When we reference this package, it will fetch the package from that path instead of installing online. Not sure if this can be the cause of your issue,you can try repair the .net core 2.2 sdk and check if the package exists in that folder.
5.Make sure the installation is not interrupted for Internet issue.
I had a similar problem that was a result of having multiple projects in one solution where they didn’t all target the same version of NET. I was able to get it working again by unloading the NET framework projects while I worked on the NET Core/NET Standard projects and vice versa.
Trying to install Microsoft.Azure.CosmosDB.Table version 1.1.3, but keep getting the error
Unable to resolve dependency 'Microsoft.Azure.Storage.Common'.
Source(s) used: 'nuget.org', 'Microsoft Visual Studio Offline
Packages'
My current project is from the Azure QnA bot template
Any help with this would be much appriciated!
Error installing Microsoft.Azure.CosmosDB.Table NuGet
This is a known issue on GitHub, if project is configured to use packages.config this issue will manifest itself.
And this issue is fixed for PackageReference. NuGet team are determining if needs to fix this for packages.config, or leave it as is.
Before add nuget package, go to Tools-Options->NuGet Package Manager->General, change the default package management format to PackageReference. Then restart the Visual Studio, reload your project, add that package.
If you still get the same error, please check following Troubleshooting:
Use Package Manage Console to install the Microsoft.Azure.CosmosDB.Table package and its dependencies. To do
this, type the following in the Package Manager Console for your
solution.
Install-Package Microsoft.Azure.CosmosDB.Table -IncludePrerelease
Using your preferred Nuget package management tool, install the Microsoft.Azure.Storage.Common Nuget package before installing
Microsoft.Azure.CosmosDB.Table.
Hope this helps.
I am trying to install the NuGet package Xamarin.Firebase.Auth and every time I do I get an error saying
Could not install package 'Xamarin.Firebase.Auth 42.1001.0'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
The catch is that about a week ago I was working on this same project and had the package installed with no problems. Then my laptop's install of windows was corrupted and I had to reinstall. I lost that day's work and now the package gives the aforementioned error. I can't find anything else that has changed, any ideas?