Skip to content

Instantly share code, notes, and snippets.

@dtchepak
Created June 28, 2012 23:22
Show Gist options
  • Save dtchepak/3014681 to your computer and use it in GitHub Desktop.
Save dtchepak/3014681 to your computer and use it in GitHub Desktop.
[SOLVED] NSub error on mono when built with vs2012 tools
-- 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; }}
}
@dtchepak
Copy link
Author

@dsplaisted Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment