在Mono上用F#签署DLL的问题

时间:2010-09-17 06:36:04

标签: f# mono assembly-signing

我试图在单声道上用F#签署一个dll时遇到错误:

$ mono /usr/local/share/FSharp-2.0.0.0/bin/fsc.exe\
   --target:library \
   --keyfile:../../external/MyKeyFile.snk\
   AssemblyInfo.fs\
   ../../fs/FooBar.fs\  
   -o:FooBar.dll

没有生成dll,我收到此错误:

Microsoft (R) F# 2.0 Compiler build 2.0.0.0 Copyright (c) Microsoft Corporation. All Rights Reserved.`

error FS2014: A problem occurred writing the binary '': A call to StrongNameGetPublicKey failed (mscoree.dll)`

密钥文件是在Windows中生成的,这有什么区别吗?

更新

使用Mono 2.6.4

$ mono --version 

Mono JIT compiler version 2.6.4 (tarball Mon Jun 21 19:26:21 UTC 2010) 
Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
TLS:           __thread
GC:            Included Boehm (with typed GC and Parallel Mark)
SIGSEGV:       altstack
Notifications: epoll
Architecture:  amd64
Disabled:      none

2 个答案:

答案 0 :(得分:3)

看起来fsc是P / Invoking本机Windows API,它不可移植。您可能应该向F#团队提出问题。

答案 1 :(得分:2)

生成程序集后尝试使用sn签名。

要做到这一点,首先需要使用--delaysign flag进行编译,以生成延迟签名的程序集。

然后,您可以使用带有-R标志的sn实用程序来对程序集进行签名。

我不是百分百肯定这会起作用,因为我没有Linux或Mac机器来测试它。虽然值得一试。