Adding nuget to User code

Ranorex Studio, Spy, Recorder, and Driver.
jsmith
Posts: 36
Joined: Mon Mar 05, 2018 4:03 pm

Adding nuget to User code

Post by jsmith » Thu Mar 21, 2019 12:41 pm

Hello,
I have some User code. I would like to add the Aforge.Core nuget package and use it in my user code.
I have succesfully added the nuget package using Manage Packages.
But now my build fails at the line:
using Aforge;

with a CS0246 error
The type or namespace name 'AForge' could not be found (are you missing a using directive or an assembly reference?) (CS0246) -

I've got an itchy feeling I've missed a step, but I can't see where. Can anyone help?

User avatar
Stub
Posts: 515
Joined: Fri Jul 15, 2016 1:35 pm

Re: Adding nuget to User code

Post by Stub » Thu Mar 21, 2019 3:03 pm

Is the NuGet-ed package listed in the References section of the build target that's failing to compile, with the same icon as all of the other references? I mean as in not a 'warning' icon to indicate something is wrong with it?

jsmith
Posts: 36
Joined: Mon Mar 05, 2018 4:03 pm

Re: Adding nuget to User code

Post by jsmith » Thu Mar 21, 2019 3:07 pm

Hi Stub,
It seems that, when I ticked multiple boxes to add the nuget package to my different projects, it did not do so. Some of the projects didn't throw the error and looking at their reference folders, they had the reference. I tried at the solution level to install them again, but without success. As a solution, I have right mouse clicked on the reference folder of each project and selected Manage PAckages from there. In the dialog that pops up I have added the nuget there.
This has solved the issue for me.