Scott Mooney
Scott Mooney

Reputation: 195

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.

Upvotes: 15

Views: 18587

Answers (5)

PSU26
PSU26

Reputation: 101

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:

  1. Uninstall all NuGet Packages [This removes the package.config file]
  2. Go to Tools --> Options --> NuGet Package Manager --> General
  3. Change the default package management format to "PackageReference"
  4. Check "allow format selection on first package install"
  5. Click OK
  6. 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

Upvotes: 10

Doug Schofield
Doug Schofield

Reputation: 21

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.

Upvotes: 1

Josef Bauer
Josef Bauer

Reputation: 370

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.

Upvotes: 28

Thesane
Thesane

Reputation: 1398

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.

Upvotes: 0

MrZane2u
MrZane2u

Reputation: 341

I encountered the same error. I don't know why we're getting it, but I was able to find a workaround.

  1. Visit the nuget page for the package.
  2. Click "Download Package" to download the nuget package directly.
  3. Open the downloaded file using your archive utility of choice and navigate to the "\runtimes\win-x64\native" folder.
  4. 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.

Upvotes: 6

Related Questions