I'm a big fan of MSpec so naturally I wanted to use is right away with VS2010 as well. I have the MSpec runner defined as an external tool in Visual Studio to be able to have it always visible as a toolbar item.
Anyway, whenever I try to use the MSpec runner (mspec.exe) with a .NET 4.0 solution I get the following error:
Could not load file or assembly 'file:///C:\Users\[SOMEUSER]\[SOME_FOLDERS]\bin\Debug\[PROJECT].Specs.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
I can still run my specs with the Resharper 5 runner so it's no big drama, but I bothers me to no end :þ
Do you guys have any idea what the problem could be? Is there any solution other than recompiling the whole Mspec source code as a .NET 4.0 solution, which I really, really don't want to do?
Thanks in advance.
Sergi
Use my net4
branch which contains a version of MSpec that is compatible with .NET 4.0. We're working on integrating these changes into MSpec's master.
http://github.com/agross/machine.specifications/tree/net4
Update: Current builds are available on Codebetter's TeamCity server (Choose guest login)
I fixed this issue by running the tests with the mspec-clr4.exe
instead.
来源:https://stackoverflow.com/questions/2816924/using-mspec-runner-in-visual-studio-2010-and-net-4