Can't Install Nuget Package - c#

I am trying to install System.Runtime.Handles so I can use SafeAccessTokenHandle and RunImpersonated, however when I try to install the package I get the error :
Could not install package 'System.Runtime.Handles 4.3.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.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.
I have done some research and I do not believe there is a .NETFramework, Version=v4.3.0. Does anybody have an idea on how to install this package?

I have done some research and I do not believe there is a .NETFramework, Version=v4.3.0. Does anybody have an idea on how to install this package?
First, you have to make sure the version of NuGet Package Manager for Visual Studio 2013 is the latest version 2.12.0.817, not the default version 2.8. You can check it from Tools->Extensions and Updates->Installed.
That because this nuget package require the NuGet 2.12 or higher.
Second, you should make sure you have installed the .net 4.6 and above. You should not change the framework version by unloading the project, opening the project file, changing the target framework, and then reloading the file. In this way, Visual Studio can not help to check if you have install that target framework. You should change it by right on the project select Properties->Application->Target framework:
If you do not have target framework .net 46, you can click the Install other frameworks to install it. For this question, you can just change your target framework to 4.7.1 directly.
Hope this helps.

Related

Emgu error when trying to install emgu.CV.runtime.windows in VC# 2017

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.

Telerik UI for UWP NuGet install not working

I am trying to download the Telerik UI for UMP NuGet package using the NuGet Package Manager (I have also tried the console) and I get the following error:
Could not install package 'Telerik.UI.for.UniversalWindowsPlatform 1.0.1.2'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.1', 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.
I have tried changing my .NETFramework version to 4.6.1 as well but it did not work. Is there something I am missing here? It shouldn't be this hard to add a NuGet package, yet here I am... Thank you in advance!
Telerik.UI NuGet spec does not support .NET. It only supports Windows Universal.

Could not install NuGet package MPI.NET 1.3.0 in MS Visual Studio 2017

I am trying to install NuGet package MPI.NET 1.3.0 to MS Visual Studio 2017 C# project. I am getting the following error:
Could not install package 'MPI.NET 1.3.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.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.
I have tried to create C# projects in different versions of .NET Framework, but it would not install. On the official GitHub site for this package (MPI.NET GitHub repository) it is written that the package is updated for .NET 4.0. I have tried creating 4.0 and lower projects, but no success.
Help anyone?
Looking at the packages available on nuget.org, version 1.3.0 targets .NET 4.6.2, whereas version 1.2.0 targets .NET 4.0. So if you try to install version 1.2.0 of the package into your project, you should be okay. It sounds like the GitHub documentation needs to be updated to reflect this new reality.
(Personally I would bump the major version number for a change like this, given that it's not necessarily backwardly compatible for existing users, but semantic versioning is less cut and dried than it sometimes sounds.)

Restrict Dependencies to specific .NET version using NuGet

I have a C# solution targeted for framework 4.5.1 but the server I need to install this on uses 4.0 so I need to roll this back.
The developer has used NuGet (which I'm not really familiar with) for dependency management. I've seen there is a way to request specific versions of each library so I'm hoping there is a feature which allows me to restrict these to a specific .NET version.
How can I get NuGet to install the latest dependencies for .NET version 4, or is this not a feature it supports?
If you change the target framework of the project then Visual Studio will check the compatibility of the NuGet packages and tell you which ones are compatible or not and whether they need to be reinstalled. You can then reinstall them from the Package Manager console using the -reinstall option.
Update-Package –reinstall <packageName>
NuGet does not directly support a way to restrict or install NuGet packages for a specific .NET version. The NuGet package will either support that .NET version or not. You can restrict a project to a specific version of the NuGet package by using the allowedVersions attribute in the packages.config file but that is independent of the .NET version the NuGet package supports.
Nuget should install packages that are available for the targeted version of .NET
Check your packages folder, or check the documentation of each dependency for support of .NET 4.0
In some cases you may just be able to re-target your application without uninstalling any Nuget packages.
To install a specific version of a Nuget package, you can use the "-Version" flag
Example -
Install-Package AvalonDock -Version 2.0.1320
References -
http://docs.nuget.org/Consume/Package-Manager-Console
http://dutton.me.uk/2013/07/24/how-to-install-a-specific-version-of-a-package-with-nuget/

NuGet: Could not install package VVVV.EmguCV 2.4.2.1

I'm using Visual Studio 2013. I create a new project Windows Form Application (C#), with target framework in tab Application in Properties of the my project: .NET Framework 3.5.
When I open NuGet and search EmguCV and click install show this error:
Installing 'VVVV.EmguCV 2.4.2.1'.
Successfully installed 'VVVV.EmguCV 2.4.2.1'.
Adding 'VVVV.EmguCV 2.4.2.1' to RadarOCR.Desktop.
Uninstalling 'VVVV.EmguCV 2.4.2.1'.
Successfully uninstalled 'VVVV.EmguCV 2.4.2.1'.
Install failed. Rolling back...
Could not install package 'VVVV.EmguCV 2.4.2.1'. You are trying to install this package
into a project that targets '.NETFramework,Version=v3.5', 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.
I do not know what's wrong! Help-me please!
The error message tells you what the problem is:
You are trying to install this package
into a project that targets '.NETFramework,Version=v3.5', but the package does not contain
any assembly references or content files that are compatible with that framework.
The VVVV.EmguCV NuGet package does not support being installed into a project that targets .NET 3.5.
Looking inside the VVVV.EmguCV NuGet package it has custom MSBuild target files for .NET 4.0 and no other .NET framework version. So if you want to install it you would need to change your project so it targets .NET 4.0 or higher.

Categories

Resources