-
-
Save dtchepak/3014681 to your computer and use it in GitHub Desktop.
-- Sorted, see https://gist.github.com/3014681#gistcomment-360816 | |
~/dev/git/mononsub % gmcs -sdk:4 Program.cs -reference:NSubstitute.dll | |
Missing method .ctor in assembly /Users/dave/dev/git/mononsub/NSubstitute.dll, type System.Runtime.Versioning.TargetFrameworkAttribute | |
Can't find custom attr constructor image: /Users/dave/dev/git/mononsub/NSubstitute.dll mtoken: 0x0a00085a | |
~/dev/git/mononsub % dmcs Program.cs -reference:newsub40/NSubstitute.dll | |
Missing method .ctor in assembly /Users/dtchepak/dev/git/mononsub/newsub40/NSubstitute.dll, type System.Runtime.CompilerServices.ExtensionAttribute | |
Can't find custom attr constructor image: /Users/dtchepak/dev/git/mononsub/newsub40/NSubstitute.dll mtoken: 0x0a000850 | |
-- No error when using NSubstitute.dll built via vs2010 tools. | |
-- Only happens with vs2012 tools, and in the DLL targeting net40 (the net35 one works ok). | |
-- Current nuget/github version is built w/vs2012 (http://nsubstitute.github.com/). | |
-- http://bit.ly/nsubbuilds latest is vs2010 tools (login as guest). | |
-- Program.cs | |
using System; | |
using NSubstitute; | |
public class Program { | |
public static void Main() { | |
var foo = Substitute.For<IFoo>(); | |
foo.Foo = "hello"; | |
Console.WriteLine(foo.Foo); | |
} | |
public interface IFoo { string Foo { get; set; }} | |
} |
Mono version (on OS X):
~/dev/git/mononsub % mono --version
Mono JIT compiler version 2.10.9 (tarball Mon May 7 20:25:51 EDT 2012)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: normal
Notification: kqueue
Architecture: x86
Disabled: none
Misc: debugger softdebug
LLVM: yes(2.9svn-mono)
GC: Included Boehm (with typed GC)
~/dev/git/mononsub % dmcs --version
Mono C# compiler version 2.10.9.0
This is an issue with how the ilmerge is being done. See this blog post for how to fix it: http://www.mattwrock.com/post/2012/02/29/What-you-should-know-about-running-ILMerge-on-Net-45-Beta-assemblies-targeting-Net-40.aspx
@dsplaisted Thanks!
@shiftkey compared manifests of the net40 DLLs on nuget and the one on the build server, found the following difference:
[mscorlib]System.Runtime.CompilerServices.ExtensionAttribute
(from vs2012 tools build)versus
[System.Core]System.Runtime.CompilerServices.ExtensionAttribute
(from build server build)