我想知道是否有一种受支持的方法,可以使用.net核心控制台应用程序包含特定运行时标识符的本机库,以便在发布应用程序后,在运行应用程序时通过PInvoke加载当前正确的本机库
至少对于nuget包似乎有一种方法,因为在发布引用libuv包的应用程序后,app.deps.json
包含这个:
"Libuv/1.10.0": {
"runtimeTargets": {
"runtimes/linux-arm/native/libuv.so": {
"rid": "linux-arm",
"assetType": "native"
},
"runtimes/linux-arm64/native/libuv.so": {
"rid": "linux-arm64",
"assetType": "native"
},
"runtimes/linux-armel/native/libuv.so": {
"rid": "linux-armel",
"assetType": "native"
},
"runtimes/linux-x64/native/libuv.so": {
"rid": "linux-x64",
"assetType": "native"
},
"runtimes/osx/native/libuv.dylib": {
"rid": "osx",
"assetType": "native"
},
"runtimes/win-arm/native/libuv.dll": {
"rid": "win-arm",
"assetType": "native"
},
"runtimes/win-x64/native/libuv.dll": {
"rid": "win-x64",
"assetType": "native"
},
"runtimes/win-x86/native/libuv.dll": {
"rid": "win-x86",
"assetType": "native"
}
}
},
从理论上讲,这正是我对应用所需要的,但我不知道如何让dotnet publish
来制作它。