C# – Can’t build project with Fakes assembly

cmicrosoft-fakesunit testing

I've added a Fakes assembly to my Visual Studio 2012 unit test project, corresponding to my application project (the System Under Test), as described in Peter Provost's article. However, the project will no longer build, on account of an unresolved type reference in the generated Fakes code:

The type or namespace name 'FieldDefinition' does not exist in the namespace 'bc::ProductStudio' (are you missing an assembly reference?)
[C:\Users\arvek\Projects\Project\Project.Tests\obj\Debug\Fakes\bc\f.csproj]
C:\Users\arvek\Projects\Project\Project.Tests\f.cs

What's going wrong here? From what I know, this is supposed to just work, so it would seem to me there's a bug in the Fakes facilities.

Best Answer

This bug is present in VS2013 as well. Link to MSDN bug.

Work Around: Delete file .messages from FakeAssemblies folder.

Related Topic