libsodium-net
libsodium-net copied to clipboard
DNX Support
Adding this library to an ASP.NET 5 RC1 project causes a runtime error of not finding the libsodium.dll
file. So it seems the Baseclass.Contrib.Nuget.Output
package doesn't do it's job anymore?
@raymens are you using the newest libsodium-net package (0.9.0-beta5)?
@bitbeans Yup
Update: Copying the %userprofile%\.dnx\packages\libsodium-net\0.9.0-beta5\output\libsodium.dll
file to %userprofile%\.dnx\packages\libsodium-net\0.9.0-beta5\lib\Net40
seems to fix this.
I`am not the DNX specialist, but i think there is no output folder, to copy from? https://github.com/baseclass/Contrib.Nuget#baseclasscontribnugetoutput
So, you are right :)
See the update in my previous message that I just posted when you posted your answer. Seems to be a workaround for development.
The use of Baseclass.Contrib.Nuget.Output
has addressed the issue of how to distribute the unmanaged binaries, as because of how NuGet works, they can't be dropped in the lib
folder. But, it's also caused more than its share of issues.
Long term, we may need to find a better way of dealing with these files in the NuGet package.
Maybe this can help ? http://blog.3d-logic.com/2015/11/10/using-native-libraries-in-asp-net-5/ (not my blog).
I found a viable workaround for using libsodium-net in DNX projects (tested on RC1) currently.
Just add a class library (package) project and reference it from the main app project.json.
The class library project.json should look like this:
{
"version": "1.0.0",
"frameworks": {
"dnx451": { }
},
"packInclude": {
"runtimes/": "runtimes/**"
}
}
Next, make the directory structure inside the class library project look like this:
<project root>
|_ project.json
|_ runtimes
|_win7-x64
| |_ native
| |_ libsodium.dll (from "output" dir of nuget package and rename it from libsodium-64.dll)
|_ win7-x86
|_ native
|_ libsodium.dll (from "output" dir of nuget package)
With libsodium-net also referenced in project.json of main app, now it works without giving "cannot find dll" exception.
Example by MS: https://github.com/aspnet/dnx/tree/dev/misc/DllImportTestProjects/src
Hope that helps anyone until this bug is fixed (tested on 0.9.0 version on ASP.net 5 RC1 and VS2015).
See also: Issue #148