views:

100

answers:

2

I'm getting an error trying to sign a dll in F# on mono:

$ 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

No dll is generated, and I get this error back:

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)`

The keyfile was generated in Windows, does that make any difference?

Update:

Using 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  A: 

It looks like fsc is P/Invoking native Windows API, which is not portable. You should probably raise the issue with the F# team.

mhutch
Thanks, have done and will report back here.
Benjol
+1  A: 

Try using sn to sign after you generate the assembly.

To do this you first need to compile with the --delaysign flag to produce a delay signed assembly.

You can then use the sn utility with the -R flag to sign the assembly afterward.

I'm not 100% sure this will work as I don't have a Linux or Mac machine around to test it on. It's worth a shot though.

Rick Minerich
I've looked and can't work out how to sign a previously unsigned assembly... Any pointers welcome...
Benjol
I added more info. Hope this helps.
Rick Minerich