Поэтому я сделал провел кучу исследований, узнал о фреймворках и xcframework, а также провел рефакторинг моего nupkg, чтобы включить встроенную зависимость в структуру xcframework. При этом iOS csproj создает и развертывает как сборку .NET, так и ее собственную зависимость с приложением, но теперь приложение выдает DllNotFoundException при попытке загрузить эту собственную зависимость.
В окне вывода отладки Visual Studio о проблеме указано только следующее:
Код: Выделить всё
**System.DllNotFoundException:** 'nerdbank_qrcodes'
Или, альтернативно, что я делаю не так? Вот макет моего nupkg:
Код: Выделить всё
D:\PACKAGES\NUGET\NERDBANK.QRCODES\0.2.55-BETA-G209A879921
| .nupkg.metadata
| nerdbank.qrcodes.0.2.55-beta-g209a879921.nupkg
| nerdbank.qrcodes.0.2.55-beta-g209a879921.nupkg.sha512
| nerdbank.qrcodes.nuspec
| README.md
| THIRD_PARTY_DEPENDENCIES.txt
| THIRD_PARTY_LICENSES.yml
|
+---lib
| +---net8.0
| | Nerdbank.QRCodes.dll
| | Nerdbank.QRCodes.xml
| |
| +---net8.0-ios17.5
| | | Nerdbank.QRCodes.dll
| | | Nerdbank.QRCodes.xml
| | |
| | \---Nerdbank.QRCodes.resources
| | | manifest
| | |
| | \---nerdbank_qrcodes.xcframework
| | | Info.plist
| | |
| | +---ios-arm64
| | | \---nerdbank_qrcodes.framework
| | | Info.plist
| | | nerdbank_qrcodes
| | |
| | \---ios-arm64_x86_64-simulator
| | \---nerdbank_qrcodes.framework
| | Info.plist
| | nerdbank_qrcodes
| |
| \---net8.0-windows7.0
| Nerdbank.QRCodes.dll
| Nerdbank.QRCodes.xml
|
\---runtimes
+---android-arm64
| \---native
| libnerdbank_qrcodes.so
|
+---android-x64
| \---native
| libnerdbank_qrcodes.so
|
+---linux-arm64
| \---native
| libnerdbank_qrcodes.so
|
+---linux-x64
| \---native
| libnerdbank_qrcodes.so
|
+---osx-arm64
| \---native
| libnerdbank_qrcodes.dylib
|
+---osx-x64
| \---native
| libnerdbank_qrcodes.dylib
|
+---win-arm64
| \---native
| nerdbank_qrcodes.dll
|
\---win-x64
\---native
nerdbank_qrcodes.dll
Код: Выделить всё
# copy Info.plist and the binary into the appropriate .framework directory structure
# so that when NativeBindings.targets references it with ResolvedFileToPublish, it will be treated appropriately.
$RustTargetBaseDir = "$repoRoot/src/nerdbank-qrcodes/target"
$RustDylibFileName = "libnerdbank_qrcodes.dylib"
$DeviceRustOutput = "$RustTargetBaseDir/aarch64-apple-ios/$Configuration/$RustDylibFileName"
$SimulatorX64RustOutput = "$RustTargetBaseDir/x86_64-apple-ios/$Configuration/$RustDylibFileName"
$SimulatorArm64RustOutput = "$RustTargetBaseDir/aarch64-apple-ios-sim/$Configuration/$RustDylibFileName"
$DeviceFrameworkDir = "$repoRoot/bin/$Configuration/device/nerdbank_qrcodes.framework"
$SimulatorFrameworkDir = "$repoRoot/bin/$Configuration/simulator/nerdbank_qrcodes.framework"
New-Item -Path $DeviceFrameworkDir,$SimulatorFrameworkDir -ItemType Directory -Force | Out-Null
Write-Host "Preparing Apple iOS and iOS-simulator frameworks"
Copy-Item $IntermediatePlistPath "$DeviceFrameworkDir/Info.plist"
Copy-Item $IntermediatePlistPath "$SimulatorFrameworkDir/Info.plist"
Write-Host "Created Info.plist with version $version"
if ($IsMacOS) {
# Rename the binary that contains the arm64 architecture for device.
lipo -create -output $DeviceFrameworkDir/nerdbank_qrcodes $DeviceRustOutput
install_name_tool -id "@rpath/nerdbank_qrcodes.framework/nerdbank_qrcodes" "$DeviceFrameworkDir/nerdbank_qrcodes"
chmod +x "$DeviceFrameworkDir/nerdbank_qrcodes"
# Create a universal binary that contains both arm64 and x64 architectures for simulator.
lipo -create -output $SimulatorFrameworkDir/nerdbank_qrcodes $SimulatorX64RustOutput $SimulatorArm64RustOutput
install_name_tool -id "@rpath/nerdbank_qrcodes.framework/nerdbank_qrcodes" "$SimulatorFrameworkDir/nerdbank_qrcodes"
chmod +x "$SimulatorFrameworkDir/nerdbank_qrcodes"
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... -device-fo