I'm developing a C sharp application in Visual Studio for Mac.
I have it set up to be signed with a developer ID signature to get it notarized by Apple.
But it's not working.
Here are the steps.
(1). Sign the code using Visual Studio for Mac.
(2). However, this .app file will crash.
(3). When I create a dmg and request notarization with the xcrun altool command, I get the following error.
Even if this succeeds, it won't matter because it will crash...
Thinking that SQLite.Interop.dll was the cause, I signed the code directly after step (1) and it started successfully.
However, requesting a notarization with the xcrun altool command returns an error like this:
I thins this is due to a change in the signature of the dependency SQLite.Interop.dll, which has resulted in an incorrect signature in MyApp.
How can I solve this?
Here's what I've already tried.
I'm using SQLite.Interop.dll in System.Data.SQLite.Core, which I got from NuGet.
I have it set up to be signed with a developer ID signature to get it notarized by Apple.
But it's not working.
Here are the steps.
(1). Sign the code using Visual Studio for Mac.
(2). However, this .app file will crash.
(3). When I create a dmg and request notarization with the xcrun altool command, I get the following error.
Code Block { "logFormatVersion": 1, "jobId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "status": "Invalid", "statusSummary": "Archive contains critical validation errors", "statusCode": 4000, "archiveFilename": "MyApp.dmg", "uploadDate": "2020-08-18T08:29:55Z", "sha256": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "ticketContents": null, "issues": [ { "severity": "error", "code": null, "path": "MyApp.dmg/MyApp.app/Contents/MonoBundle/SQLite.Interop.dll", "message": "The signature of the binary is invalid.", "docUrl": null, "architecture": "x86_64" } ] }
Even if this succeeds, it won't matter because it will crash...
Thinking that SQLite.Interop.dll was the cause, I signed the code directly after step (1) and it started successfully.
Code Block $ codesign --force --verify --verbose \ --sign "Developer ID Application: MyCompany (XXXXXXXXX)" \ "SQLite.Interop.dll" \ --deep \ --options runtime \ --timestamp
However, requesting a notarization with the xcrun altool command returns an error like this:
Code Block { "logFormatVersion": 1, "jobId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "status": "Invalid", "statusSummary": "Archive contains critical validation errors", "statusCode": 4000, "archiveFilename": "MyApp.dmg", "uploadDate": "2020-08-18T08:29:55Z", "sha256": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "ticketContents": null, "issues": [ { "severity": "error", "code": null, "path": "MyApp.dmg/MyApp.app/Contents/MacOS/MyApp", "message": "The signature of the binary is invalid.", "docUrl": null, "architecture": "x86_64" } ] }
I thins this is due to a change in the signature of the dependency SQLite.Interop.dll, which has resulted in an incorrect signature in MyApp.
How can I solve this?
Here's what I've already tried.
Manually sign MyApp.dmg/MyApp.app/Contents/MacOS/MyApp again.
Sign SQLite.Interop.dll manually before the procedure (1).
Settings for signing .csproj files
Code Block <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <Optimize>true</Optimize> <OutputPath>bin\Release</OutputPath> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <EnableCodeSigning>true</EnableCodeSigning> <CreatePackage>false</CreatePackage> <EnablePackageSigning>false</EnablePackageSigning> <IncludeMonoRuntime>true</IncludeMonoRuntime> <UseSGen>true</UseSGen> <UseRefCounting>true</UseRefCounting> <LinkMode>SdkOnly</LinkMode> <AOTMode>None</AOTMode> <CodeSigningKey>Developer ID Application: MyCompany (XXXXXXXXXXX)</CodeSigningKey> <PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey> <UseHardenedRuntime>true</UseHardenedRuntime> <CodeSignEntitlements>Entitlements.plist</CodeSignEntitlements> <CodeSignExtraArgs>--deep</CodeSignExtraArgs> </PropertyGroup>
Entitlements.plist
Code Block <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.security.cs.allow-jit</key> <true/> </dict> </plist>
I'm using SQLite.Interop.dll in System.Data.SQLite.Core, which I got from NuGet.
Code Block packages/System.Data.SQLite.Core.1.0.111.0/runtimes/osx-x64/native/netstandard2.0/SQLite.Interop.dll