Support or Documentation of Creating of Packages with Native Applications - PhantomJS
greghroberts opened this issue · 1 comments
Details about Problem
This is either a documentation problem, a potential clarification, or possibly a feature request.
My scenario is that I want to create a package for a native binary executable, like phantomjs, not a library. I want that binary to be put in the output folder on build or a known path that is appropriate for the user's current OS and can be programmed against easily.
Using the snippet below for a package only copies to the runtimes folder on dotnet publish. So it's unclear what path you should program against to launch the process. Unlike libraries where you use DllImport attribute which does some magic to locate the lib, it's unclear how to locate this package during development.
Overall, I just want to know what is best practice for this situation. Other languages, package managers handle this fine.
Example of how NPM handles this. https://www.npmjs.com/package/phantomjs
Ruby Gem https://rubygems.org/gems/phantomjs/versions/2.1.1.0
Snippet from my project.json of package
"packOptions": {
"tags": [
"phantomjs", "pdf"
],
"files": {
"mappings": {
"/": "License.txt",
"runtimes/win7-x64/native/": "runtimes/win7/native/*",
"runtimes/win7-x86/native/": "runtimes/win7/native/*",
"runtimes/osx/native/": "runtimes/osx/native/*",
"runtimes/linux/native/": "runtimes/linux-x64/native/*",
"runtimes/debian-x64/native/": "runtimes/linux-x64/native/*",
"runtimes/opensuse-x64/native/": "runtimes/linux-x64/native/*",
"runtimes/fedora-x64/native/": "runtimes/linux-x64/native/*"
}
}
},
NuGet product used (dotnet.exe and project.json):
3.4.4.1321
dotnet.exe --version (if appropirate):
1.0.0-preview2-003121
VS version (if appropriate):
NA
OS version (i.e. win10 v1607 (14393.321)):
Any
@greghroberts If I understand your problem correctly, https://stackoverflow.com/questions/49162127/how-to-include-native-assets-in-nuget-on-multiple-platforms-only-64-bit should help doing this. I used this arrangement to package a native 64 bit executable along with a .NET Standard 2.0 library and restore it as a PackageReference
in another .NET Standard 2.0 project so that it's being copied to project output. I tested by calling File.Exists(".exe")
and it was found.