I am using a text templating engine called RazorEngine to format some text for an email (not to be confused with the MVC Razor stuff - RazorEngine is an enabler for using the Razor view syntax outside of Mvc iews).
The RazorEngine seems to be doing some compiling at runtime. When the unit test is run via NCrunch, I get this error:
Code:
RazorEngine.Templating.TemplateCompilationException : Unable to compile template. The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2010\nCrunch.TestExecution.dll'
When the test is run via R#:
Code:
RazorEngine.Templating.TemplateCompilationException : Unable to compile template. 'ClassLibrary1.AnonymousClass' does not contain a definition for 'userName' and no extension method 'userName' accepting a first argument of type 'ClassLibrary1.AnonymousClass' could be found (are you missing a using directive or an assembly reference?)
Note, the template clearly has a bug (@Model.userName should be @Model.Name). Fixing the bug seems to make it work. Also using an anonymous type instead of a concrete class changes things as well. This does seem to imply that at runtime my code is being linked up to NCrunch dlls. That doesn't seem right. I haven't put this into production yet, so I don't yet know if there is a real dependency on NCrunch dlls yet.
A sample project is here:
https://s3.amazonaws.com...o304q/ClassLibrary1.zip