【问题标题】:Mono xbuild error CS1548 - key file has incorrect formatMono xbuild 错误 CS1548 - 密钥文件格式不正确
【发布时间】:2011-11-21 12:16:40
【问题描述】:

所以我试图让一个 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

【问题讨论】:

标签: c# mono pkcs#12 xbuild strong-named-key


【解决方案1】:

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

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

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

【讨论】:

  • 原谅我的无知,但是有没有一个可重复的例子说明如何将一个人的密钥导出到一个.snk 文件中并在构建一个项目时使用它?
猜你喜欢
  • 2013-09-30
  • 2016-01-27
  • 1970-01-01
  • 2012-11-08
  • 1970-01-01
  • 2017-09-18
  • 2017-12-03
  • 2011-04-23
  • 1970-01-01
相关资源
最近更新 更多