OSVR / Managed-OSVR

OSVR .NET/CLR bindings
Apache License 2.0
12 stars 11 forks source link

NuGet package for ClientKit #2

Open JeroMiya opened 9 years ago

JeroMiya commented 9 years ago

From a request in this issue: https://github.com/OSVR/OSVR-Unity/issues/6

Task:

Open questions:

JeroMiya commented 9 years ago

OK, it's a bit late, and I'm still a little woozy from some flu medicine, but I made a couple of failed attempts at this. Documenting:

Attempt 1: From ClientKit.csproj:

Results:

Attempt 2: Copying files into convention-based directory structure

Results:

Package was created successfully without warnings/errors. When opening up the nupkg all the binaries for net20 and net45 seemed to be there. However, this is the error I got when attempting to install the package into a .net 4.5 project:

Installing 'OSVR.ClientKit 0.1.5570.40638'.
Successfully installed 'OSVR.ClientKit 0.1.5570.40638'.
Adding 'OSVR.ClientKit 0.1.5570.40638' to ConsoleApplication1.
Uninstalling 'OSVR.ClientKit 0.1.5570.40638'.
Successfully uninstalled 'OSVR.ClientKit 0.1.5570.40638'.
Install failed. Rolling back...
Failed to add reference to 'msvcp120'.

Next steps:

rpavlik commented 9 years ago

Thanks for looking into this - I was hoping you would.

Not sure how cross-platform-usable msbuild files are, but the main root one (that is an alternative to using the .sln file) is where I anticipated a "make a NuGet-convention directory structure" target/script would go. The other item is that we could make a target in that file that overrides properties so that it builds directly into the correct directory structure.

The 'msvcp120' and the other similarly named file is just the VS2013 C/C++ runtime DLLs - we bundled it with the native library to keep people from needing to install the redist, but it can be left out and just simply state "hey, you have to have the redist". That might be all it takes to get that package working properly

Note that the line here: https://github.com/OSVR/Managed-OSVR/blob/master/ClientKit/ClientKit.cs#L111 and the one a bit later for 32-bit gives some flexibility in where the native libraries are w.r.t. the managed assembly.

JeroMiya commented 9 years ago

OK, I have this working: https://github.com/JeroMiya/Managed-OSVR/commit/bb76dc0285df646e8ed70d7bbe3fd1106c2b3bd7

I was able to install this NuGet package locally into a console application project and copy any of the command line sample code into the new project and they run. I'm basing my implementation on how libgit2 packages their native library, except I'm not separating the managed and native assemblies into two NuGet packages. Not sure why we'd need to do that.

I do need some things from the OSVR team:

The metadata is specified in the NuGetPackaging/OSVR.ClientKit.nuspec file.

For reference: https://github.com/libgit2/libgit2sharp/issues/974

JeroMiya commented 9 years ago

FYI: I have that section of NuGetPackaging/build/OSVR.ClientKit.props commented out, but this method would hypothetically allow us to distribute native binaries for Mac/Linux on mono as well as for Windows.

rpavlik commented 9 years ago

Thanks! I do think eventually we would want to separate out the native binaries, for either convenience (not having to rev the managed OSVR package with every revision of the native binaries) and/or NuGet for C++ (which is even more of a mysterious unicorn to me but sounded like a good idea when I read about it in some MSVC blog).

Will add a few commit comments inline, but go ahead and open a pull request, and/or let me know when you're ready for me to merge that.

JeroMiya commented 9 years ago

I'll look into updating the metadata per your line notes and submit a pull request this evening.

As for the icon, 32x32 will do, but I see most packages are using 64x64. I think it shows 32x32 in the Visual Studio UI but 64x64 in the web site listing on nuget.org. Also, the one you pointed to will do for now, but you may want to copy it somewhere and name it something with 'nuget' in the name. Otherwise if you're editing that site you may not know that the icon is being used for the NuGet package and move/delete/change it by mistake.

rpavlik commented 9 years ago

So the NuGet docs said 32x32, which is why I did that. I've since committed a 64x64 to the repo and used rawgit.com to generate a stable, CDN-backed URL for it.

Thanks!

JeroMiya commented 9 years ago

Hmm, I was basing it off of some examples from NuGet.org. Apparently the spec says 32x32, but if the image is larger the UI is supposed to scale down to 32x32. Meanwhile the NuGet.org website itself displays it at several resolutions, even up to 128x128: https://nuget.codeplex.com/workitem/2453

JSON.Net uses a 64x64 image: http://www.newtonsoft.com/content/images/nugeticon.png

JeroMiya commented 9 years ago

Pull request made: https://github.com/OSVR/Managed-OSVR/pull/4