C# can';t使用Visual Studio for Mac对.app文件进行代码设计
我正在Visual Studio中为Mac开发一个C#应用程序。C# can';t使用Visual Studio for Mac对.app文件进行代码设计,c#,macos,sqlite,code-signing,xamarin.mac,C#,Macos,Sqlite,Code Signing,Xamarin.mac,我正在Visual Studio中为Mac开发一个C#应用程序。 我已将其设置为使用开发者ID签名进行签名,以获得苹果的公证。 但它不起作用 以下是步骤 (1) 。使用Visual Studio for Mac对代码进行签名。 (2). 但是,此.app文件将崩溃。 (3). 当我创建dmg并使用xcrun altool命令请求公证时,我得到以下错误。 { "logFormatVersion": 1, "jobId": "xxxxxxxx
我已将其设置为使用开发者ID签名进行签名,以获得苹果的公证。
但它不起作用 以下是步骤 (1) 。使用Visual Studio for Mac对代码进行签名。
(2). 但是,此.app文件将崩溃。
(3). 当我创建dmg并使用xcrun altool命令请求公证时,我得到以下错误。
{
"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"
}
]
}
即使成功了,也没关系,因为它会崩溃…认为SQLite.Interop.dll是原因,我在步骤(1)之后直接对代码进行了签名,代码成功启动
$ codesign --force --verify --verbose \
--sign "Developer ID Application: MyCompany (XXXXXXXXX)" \
"SQLite.Interop.dll" \
--deep \
--options runtime \
--timestamp
但是,使用xcrun altool命令请求公证会返回如下错误:
{
"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"
}
]
}
我认为这是由于依赖项SQLite.Interop.dll的签名发生了更改,导致MyApp中的签名不正确。我怎样才能解决这个问题 这是我已经尝试过的
- 再次手动登录MyApp.dmg/MyApp.app/Contents/MacOS/MyApp。
- 在执行过程(1)之前手动签署SQLite.Interop.dll。
- 签名.csproj文件的设置
Target GenerateSatelliteAssemblies:
Creating directory "obj/Release/en".
/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5/al.exe /culture:en /out:obj/Release/en/MyApp.resources.dll /template:obj/Release/MyApp.exe /embed:obj/Release/improvementproductivityforMac.Resources.AppResources.en.resources
Target _CopyFilesMarkedCopyLocal:
Copying file from "/Users/tomityu/Gits/my-app/packages/NLog.4.6.6/lib/netstandard2.0/NLog.dll" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/NLog.dll".
Copying file from "/Users/tomityu/Gits/my-app/packages/System.Data.SQLite.Core.1.0.111.0/lib/netstandard2.0/System.Data.SQLite.xml" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/System.Data.SQLite.xml".
Copying file from "/Users/tomityu/Gits/my-app/packages/NLog.4.6.6/lib/netstandard2.0/NLog.xml" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/NLog.xml".
Copying file from "/Users/tomityu/Gits/my-app/packages/System.Data.SQLite.Core.1.0.111.0/lib/netstandard2.0/System.Data.SQLite.dll" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/System.Data.SQLite.dll".
Copying file from "/Users/tomityu/Gits/my-app/packages/System.Data.SQLite.Core.1.0.111.0/lib/netstandard2.0/System.Data.SQLite.dll.config" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/System.Data.SQLite.dll.config".
Creating "/Users/tomityu/Gits/my-app/MyApp/obj/Release/MyApp.csproj.CopyComplete" because "AlwaysCreate" was specified.
Target CopyFilesToOutputDirectory:
Copying file from "/Users/tomityu/Gits/my-app/MyApp/obj/Release/MyApp.exe" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.exe".
MyApp -> /Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.exe
Copying file from "/Users/tomityu/Gits/my-app/MyApp/obj/Release/en/MyApp.resources.dll" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/en/MyApp.resources.dll".
Target _DetectSigningIdentity:
Detected signing identity:
Code Signing Key: "Developer ID Application: MYCOMPANY (7LM65QQ5VR)" (C34D25E1BBB78996C6A0257E78A87C103A320815)
Bundle Id: jp.mycompany
App Id: jp.mycompany
Target _CopyContentToBundle:
Creating directory '/Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.app/Contents/Resources'
~
Copying file from '/Users/tomityu/Gits/my-app/MyApp/Resources/update.png' to '/Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.app/Contents/Resources/update.png'
Target _CompileToNative:
/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin/mmp @/Users/tomityu/Gits/my-app/MyApp/obj/Release/response-file.rsp
MMP : warning MM0079: The recommended Xcode version for Xamarin.Mac 6.20.2 is Xcode 11.6 or later. The current Xcode version (found in /Applications/Xcode.app/Contents/Developer) is 11.2.
MMP : warning MM2006: Native library 'libdl' was referenced but could not be found.
MMP : warning MM2009: Referenced by System.Data.SQLite.UnsafeNativeMethodsPosix.dlopen
Done building target "_CompileToNative" in project "MyApp.csproj".
Target CopyOurFiles:
This is us copying a file into resources!
Copying file from "/Users/tomityu/Gits/my-app/MyApp/NLog.config" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.app/Contents/MonoBundle/NLog.config".
Target _CodesignNativeLibraries:
Tool /usr/bin/codesign execution started with arguments: -v --force --timestamp --sign C34D25E1BBB78996C6A0257E78A87C103A320815 --deep /Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.app/Contents/MonoBundle/libmono-native.dylib
Tool /usr/bin/codesign execution started with arguments: -v --force --timestamp --sign C34D25E1BBB78996C6A0257E78A87C103A320815 --deep /Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.app/Contents/MonoBundle/libMonoPosixHelper.dylib
Target _CodesignAppBundle:
Tool /usr/bin/codesign execution started with arguments: -v --force -o runtime --timestamp --sign C34D25E1BBB78996C6A0257E78A87C103A320815 --entitlements /Users/tomityu/Gits/my-app/MyApp/obj/Release/Entitlements.xcent --deep /Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.app
Target _CodesignVerify:
/usr/bin/codesign --verify -vvvv --deep bin/Release/MyApp.app
bin/Release/MyApp.app: valid on disk
bin/Release/MyApp.app: satisfies its Designated Requirement
Done building project "MyApp.csproj".
Build succeeded.
您能够查看MSBuild在对应用程序签名时调用的命令行吗?谢谢您的评论!添加到文本中。您的新输出显示您使用的XCode版本比推荐版本旧得多(您使用的是11.2,但Xamarin需要11.6)。您使用旧版本有什么原因吗?也许更新你的XCode版本可以让它工作吗?我将XCode版本更新到11.6并重试,但结果是一样的。应用程序在步骤(2)中崩溃。有人能帮我解决此问题吗?您能查看MSBuild在对应用程序签名时调用的命令行吗?谢谢您的评论!添加到文本中。您的新输出显示您使用的XCode版本比推荐版本旧得多(您使用的是11.2,但Xamarin需要11.6)。您使用旧版本有什么原因吗?也许更新你的XCode版本可以让它工作吗?我将XCode版本更新到11.6并重试,但结果是一样的。应用程序在步骤(2)中崩溃。有人能帮我解决此问题吗?
<?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>
packages/System.Data.SQLite.Core.1.0.111.0/runtimes/osx-x64/native/netstandard2.0/SQLite.Interop.dll
Target GenerateSatelliteAssemblies:
Creating directory "obj/Release/en".
/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5/al.exe /culture:en /out:obj/Release/en/MyApp.resources.dll /template:obj/Release/MyApp.exe /embed:obj/Release/improvementproductivityforMac.Resources.AppResources.en.resources
Target _CopyFilesMarkedCopyLocal:
Copying file from "/Users/tomityu/Gits/my-app/packages/NLog.4.6.6/lib/netstandard2.0/NLog.dll" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/NLog.dll".
Copying file from "/Users/tomityu/Gits/my-app/packages/System.Data.SQLite.Core.1.0.111.0/lib/netstandard2.0/System.Data.SQLite.xml" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/System.Data.SQLite.xml".
Copying file from "/Users/tomityu/Gits/my-app/packages/NLog.4.6.6/lib/netstandard2.0/NLog.xml" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/NLog.xml".
Copying file from "/Users/tomityu/Gits/my-app/packages/System.Data.SQLite.Core.1.0.111.0/lib/netstandard2.0/System.Data.SQLite.dll" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/System.Data.SQLite.dll".
Copying file from "/Users/tomityu/Gits/my-app/packages/System.Data.SQLite.Core.1.0.111.0/lib/netstandard2.0/System.Data.SQLite.dll.config" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/System.Data.SQLite.dll.config".
Creating "/Users/tomityu/Gits/my-app/MyApp/obj/Release/MyApp.csproj.CopyComplete" because "AlwaysCreate" was specified.
Target CopyFilesToOutputDirectory:
Copying file from "/Users/tomityu/Gits/my-app/MyApp/obj/Release/MyApp.exe" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.exe".
MyApp -> /Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.exe
Copying file from "/Users/tomityu/Gits/my-app/MyApp/obj/Release/en/MyApp.resources.dll" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/en/MyApp.resources.dll".
Target _DetectSigningIdentity:
Detected signing identity:
Code Signing Key: "Developer ID Application: MYCOMPANY (7LM65QQ5VR)" (C34D25E1BBB78996C6A0257E78A87C103A320815)
Bundle Id: jp.mycompany
App Id: jp.mycompany
Target _CopyContentToBundle:
Creating directory '/Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.app/Contents/Resources'
~
Copying file from '/Users/tomityu/Gits/my-app/MyApp/Resources/update.png' to '/Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.app/Contents/Resources/update.png'
Target _CompileToNative:
/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin/mmp @/Users/tomityu/Gits/my-app/MyApp/obj/Release/response-file.rsp
MMP : warning MM0079: The recommended Xcode version for Xamarin.Mac 6.20.2 is Xcode 11.6 or later. The current Xcode version (found in /Applications/Xcode.app/Contents/Developer) is 11.2.
MMP : warning MM2006: Native library 'libdl' was referenced but could not be found.
MMP : warning MM2009: Referenced by System.Data.SQLite.UnsafeNativeMethodsPosix.dlopen
Done building target "_CompileToNative" in project "MyApp.csproj".
Target CopyOurFiles:
This is us copying a file into resources!
Copying file from "/Users/tomityu/Gits/my-app/MyApp/NLog.config" to "/Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.app/Contents/MonoBundle/NLog.config".
Target _CodesignNativeLibraries:
Tool /usr/bin/codesign execution started with arguments: -v --force --timestamp --sign C34D25E1BBB78996C6A0257E78A87C103A320815 --deep /Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.app/Contents/MonoBundle/libmono-native.dylib
Tool /usr/bin/codesign execution started with arguments: -v --force --timestamp --sign C34D25E1BBB78996C6A0257E78A87C103A320815 --deep /Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.app/Contents/MonoBundle/libMonoPosixHelper.dylib
Target _CodesignAppBundle:
Tool /usr/bin/codesign execution started with arguments: -v --force -o runtime --timestamp --sign C34D25E1BBB78996C6A0257E78A87C103A320815 --entitlements /Users/tomityu/Gits/my-app/MyApp/obj/Release/Entitlements.xcent --deep /Users/tomityu/Gits/my-app/MyApp/bin/Release/MyApp.app
Target _CodesignVerify:
/usr/bin/codesign --verify -vvvv --deep bin/Release/MyApp.app
bin/Release/MyApp.app: valid on disk
bin/Release/MyApp.app: satisfies its Designated Requirement
Done building project "MyApp.csproj".
Build succeeded.