creating nuget packages

169 views
Skip to first unread message

Johannes Larsch

unread,
Oct 18, 2016, 5:40:27 PM10/18/16
to Bonsai Users
Hi again,

I wanted to try and package a c# transforms from another post as a node. I followed your tutorials, installed visual studio 2012 (2015 wouldn't work to register bonsai). I set the nuget package settings and I can test the node. I have never used visual studio before so now I am stuck how to build the nuget package (or something else?) necessary to import this into my actual bonsai workflow. I downloaded the nuget.exe and tried nuget pack but that seemed cumbersome and didn't work without a proper nuspec file. Can you point me in the right direction once more?

johannes

goncaloclopes

unread,
Oct 18, 2016, 6:49:48 PM10/18/16
to Bonsai Users
Hi Johannes,

If you created your Visual Studio project from the Bonsai Package template, then you already have everything you need. There is only one action necessary: right-click on your Solution and select "Enable NuGet Package Restore". This will configure NuGet and build targets appropriately.

After this, just select the "Release" configuration and the package should come out automatically. Let me know if something doesn't work. I noticed you installed VS 2012, this is good, because since VS 2015 there is no built-in proper way of automatically building a nuget package (a shot through the foot from microsoft). This is expected to be fixed for the next VS version. Until then VS 2012 or VS 2013 are the recommended versions for this.

Hope this helps.

Johannes Larsch

unread,
Oct 19, 2016, 5:04:58 PM10/19/16
to Bonsai Users
Hi,
I did 'enable nuGet package restore' and I now have the nuget folder. For compiling, I selected the 'release' configuration as opposed to 'debug' but I don't see a .nupkg file anywhere. The .nuget folder contains nuget.exe, nuget.config and nuget.targets. how do I go from there?

goncal...@gmail.com

unread,
Oct 19, 2016, 5:08:19 PM10/19/16
to Johannes Larsch, Bonsai Users

Did you create the project from the Bonsai package template? If this is the case, those steps should be enough to trigger the .nupkg.

 

Just to make sure, you do have a .nuspec file in your project root, right? The package template will generate one for you automatically.

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/f95ca697-7aaa-4e10-875b-19dd07e6d11d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

Johannes Larsch

unread,
Oct 19, 2016, 5:19:05 PM10/19/16
to Bonsai Users, johanne...@gmail.com
hi, no I don't have the nuspec file in the root despite having created the project as a bonsai template (I did get the transform1.cs template for example, but no nuspec file). Sounds like my bonsai package template might be the problem?

Johannes Larsch

unread,
Oct 19, 2016, 5:22:39 PM10/19/16
to Bonsai Users, johanne...@gmail.com
I tried copying the nuget files from the .nuget folder into my root and running 'nuget spec' and 'nuget pack' from the command line. that generates a package but when I install that into bonsai the transform doesn't show up, so I am guessing I am not packaging properly. (to be honest, I have no idea how nuget works, I was just following some random google results to see how far I would get...)

Gonçalo Lopes

unread,
Oct 19, 2016, 5:39:01 PM10/19/16
to Johannes Larsch, Bonsai Users
In order for the package to be scanned for transforms at all, it needs to have "Bonsai" as a package tag. The bonsai template should take care of all these details. I agree that there is a possibility your template is outdated. When did you last install Bonsai on this computer?

Can you try downloading the latest Bonsai installer and register the package from there? The point of the template was exactly to try and avoid having to fiddle with all the bureaucracy of creating a nuget package.

On 19 October 2016 at 22:22, Johannes Larsch <johanne...@gmail.com> wrote:
I tried copying the nuget files from the .nuget folder into my root and running 'nuget spec' and 'nuget pack' from the command line. that generates a package but when I install that into bonsai the transform doesn't show up, so I am guessing I am not packaging properly. (to be honest, I have no idea how nuget works, I was just following some random google results to see how far I would get...)

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.

Johannes Larsch

unread,
Oct 19, 2016, 5:52:37 PM10/19/16
to Bonsai Users, johanne...@gmail.com
cool, making progess. I re-installed the latest version of bonsai and re-registered the bonsai template. Now I am getting the nuspec file. I guess by just updating bonsai through the package manager, I wasn't getting the newest template. makes sense.
now I get a compile error though:
Error    1    NuGet Error:Unknown command: 'overlay'    BonsaiPackage1

do you know how I can fix that?
(opencv.net and bonsai.vision are referenced in the script)

Gonçalo Lopes

unread,
Oct 19, 2016, 5:54:54 PM10/19/16
to Johannes Larsch, Bonsai Users
That's odd, I don't remember ever having this specific error message. Can you at least generate a nuget package if you start with the empty project template?

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.

Johannes Larsch

unread,
Oct 19, 2016, 6:00:30 PM10/19/16
to Bonsai Users, johanne...@gmail.com
after google, I think it has something to do with versions of opencv that get pulled from nuget depending on whether you manually install opencv.net or via dependency from bonsai.vision. I am not sure how to reproduce it but I noticed that in some of my projects, I have files with names like 'OpenCV.ffmpeg.overlay-Win32_v110.2.4.8' in my folder 'Visual Studio 2012\Projects\BonsaiPackage\packages\OpenCV.Net.3.3.0' whereas in other projects that is missing (depending on which way opencv nuget package was installed - i think). I any case, I copied the files containing ...'overlay'... over into the new project folder and now it's working.
thanks for all your help.
j
Reply all
Reply to author
Forward
0 new messages