4

所以我试图让一个 VS2010 C# 项目跨平台。第一个目标是在 Windows 的 Mono 2.10.5 中构建它。我还没有接触任何代码——我从 xbuild 最近构建 sln 文件的能力开始。(顺便说一句,我使用 Jenkins 来触发构建,这并不重要,因为我在命令行中得到了相同的结果。)

我收到“错误 CS1548:程序集签名期间出错。指定的密钥文件 `AlphaBeta.pfx' 格式不正确”。这个错误没有多少谷歌果汁。有谁知道这会导致什么?提前致谢!

下面的完整输出:

C:\Program Files\Jenkins\jobs\AlphaBeta\...\AlphaSolution>"C:\Program Files\Mono-2.10.5\bin\xbuild" AlphaSolution.sln 
XBuild Engine Version 2.10.5.0
Mono, Version 2.10.5.0
Copyright (C) Marek Sieradzki 2005-2008, Novell 2008-2011.

Build started 9/20/2011 3:54:14 PM.

C:\Program Files\Jenkins\jobs\AlphaBeta\...\AlphaSolution\AlphaSolution.sln:  warning : Ignoring vcproj 'ZBM'.
C:\Program Files\Jenkins\jobs\AlphaBeta\...\AlphaSolution\AlphaSolution.sln:  warning : Don't know how to handle GlobalSection TestCaseManagementSettings, Ignoring.
C:\Program Files\Jenkins\jobs\AlphaBeta\...\AlphaSolution\AlphaSolution.sln:  warning : Failed to find project d393406d-3397-4907-a536-2a4b77512bc6
Project "C:\Program Files\Jenkins\jobs\AlphaBeta\...\AlphaSolution\AlphaSolution.sln" (default target(s)):
    Target ValidateSolutionConfiguration:
        Building solution configuration "Debug|Mixed Platforms".
    Target Build:
        Project "C:\Program Files\Jenkins\jobs\AlphaBeta\...\AlphaSolution\AlphaCommon\AlphaCommon.csproj" (default target(s)):
            Target PrepareForBuild:
                Configuration: Debug Platform: AnyCPU
            Target GenerateSatelliteAssemblies:
            No input files were specified for target GenerateSatelliteAssemblies, skipping.
            Target CoreCompile:
                Tool C:\PROGRA~1\MONO-2~1.5\bin\dmcs.bat execution started with arguments: /noconfig /debug:full /debug+ /keyfile:AlphaBeta.pfx /optimize- /out:obj\Debug\AlphaCommon.dll AlphaCommon.cs Properties\AssemblyInfo.cs /target:library /define:"DEBUG;TRACE" /reference:C:\PROGRA~1\MONO-2~1.5\lib\mono\xbuild-frameworks\.NETFramework\v4.0\RedistList\..\..\..\..\4.0\System.dll /reference:C:\PROGRA~1\MONO-2~1.5\lib\mono\xbuild-frameworks\.NETFramework\v4.0\RedistList\..\..\..\..\4.0\System.Xml.Linq.dll /reference:C:\PROGRA~1\MONO-2~1.5\lib\mono\xbuild-frameworks\.NETFramework\v4.0\RedistList\..\..\..\..\4.0\System.Data.DataSetExtensions.dll /reference:C:\PROGRA~1\MONO-2~1.5\lib\mono\xbuild-frameworks\.NETFramework\v4.0\RedistList\..\..\..\..\4.0\Microsoft.CSharp.dll /reference:C:\PROGRA~1\MONO-2~1.5\lib\mono\xbuild-frameworks\.NETFramework\v4.0\RedistList\..\..\..\..\4.0\System.Data.dll /reference:C:\PROGRA~1\MONO-2~1.5\lib\mono\xbuild-frameworks\.NETFramework\v4.0\RedistList\..\..\..\..\4.0\System.Xml.dll /reference:C:\PROGRA~1\MONO-2~1.5\lib\mono\xbuild-frameworks\.NETFramework\v4.0\RedistList\..\..\..\..\4.0\System.Core.dll /warn:4
: error CS1548: Error during assembly signing. The specified key file `AlphaBeta.pfx' has incorrect format
            Task "Csc" execution -- FAILED
            Done building target "CoreCompile" in project "C:\Program Files\Jenkins\jobs\AlphaBeta\...\AlphaSolution\AlphaCommon\AlphaCommon.csproj".-- FAILED
4

1 回答 1

4

Mono 不支持使用 PKCS#12 (.pfx) 文件来存储用于强命名程序集的密钥。这是一个已知问题,并在 Xamarin 的 bugzilla # 725上进行了跟踪。

一种解决方法是将您的密钥导出到 .snk 文件中,并在构建项目时使用它。

此处的答案提供了如何从 .pfx 生成 .snk 的示例。

于 2011-09-21T12:56:18.020 回答