使用pfx在Visual Studio for Mac上签名程序集的MSB3322

时间:2017-08-22 16:32:20

标签: xamarin xamarin-studio pfx visual-studio-mac

在Visual Studio for Mac 7.1上,我正在尝试构建一个在Visual Studio 20176 Update 3上构建良好的项目。

项目文件的第一个错误是:

目标ResolveKeySource:

    /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(3103,5): error MSB3322: Unable to get MD5 checksum for the key file "../xxx.pfx". Could not find file "/Users/PATH/xxx.pfx".
Done building target "ResolveKeySource" in project "yyy" -- FAILED.

pfx实际上存在且可读。

启用更多日志记录后,它显示为:

error MSB4018: The "ResolveKeySource" task failed unexpectedly.
error MSB4018: System.NotSupportedException: Specified method is not supported.
error MSB4018:   at System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeInterfaceAsObject (System.Guid clsid, System.Guid riid) [0x00006] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/interopservices/runtimeenvironment.cs:204 
error MSB4018:   at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
error MSB4018:   at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/corlib/System.Reflection/MonoMethod.cs:305

我一直在改变签名的文件格式,但希望有一个可以在Windows和Mac上轻松构建的解决方案。

是否有一种用于签署程序集的文件格式的解决方案?

1 个答案:

答案 0 :(得分:0)

我刚刚使用msbuild / csc和.pfx重新编译了一些旧的基于签名的Xamarin.Android应用程序w /最新的Xamarin版本只是不起作用(除非有一些我不知道的魔法)。

但是将.pfx转换为.snk以提取公钥的工作正常,请使用" StrongName实用程序的单声道版本来签署程序集" (sn)在macOS上:

sn -p certificate.pfx certificate.snk

它会提示您输入密码,而是使用生成的.snk文件。 .snk文件也适用于Windows。