I am using Microsoft's fake testing environment. There is not as much as I need to use the shim / moles approach because of the "old" code, which I cannot change. This is code from a vendor without a source, it was written without testing. So I'm stuck in three possible frameworks: TypeMock (dear), Telerik JustMock (dear) or Microsoft Fakes. Since we already have VS Ultimate, we choose fakes. Since most people think that they need to be asked to rewrite or modify the code in some way to support the use of interfaces and / or dependency injection, I will tell you about this, this is not an option.
One of the problems I am facing is that the library that I am trying to fake is huge and requires the use of the 64-bit version of fakes.exe and not the 32-bit version (fakes.x86.exe), this works to the limit memory 32-bit applications.
The second problem is that I need to compile the fake library using the v4.5 framework. This is possible through the command line, although not documented. The reason is that in version 4.5 they added IReadOnly * interfaces to System.Collections.Generic, and the library uses them. Compiling with v4 raises an error indicating that the types were not found as expected.
The problem is, Visual Studio always uses x86 and v4.0, and I cannot find a way to override it. Does anyone know how to make it use 64bit and v4.5 structure? My current idea is to not use the built-in elements of the visual studio and just use the command line and manually link to the file. Then, each time we update the dll, we will manually recreate it and update the link. This file is not updated very often, so it is possible.
The command line that I use to create a fakes library manually (someone can find it):
"c:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\fakes\fakes.exe" <assembly> /tfv:v4.5
The help command only shows that v2, v3.5 and v4 are possible options for tfv, but only for hits I tried v4.5.
I tried to force the application architecture to use x64 instead of any processor, without any changes in which it executed fakes.exe. I looked at the .csproj file for the test, no changes. I looked in the .csproj file that fakes.exe and said that using the v4 framework open in visual studio, changed to v4.5, compiled perfectly. The fake command line is used, compiled in order. There is an attribute in the .fakes file in the project that allows you to determine the version of the compiler, but installing it on v4.5 still did not work. I assume that changing the version in visual studio from v4 to v4.5 also changed assembly references. My next attempt is to try changing the design of the template if I find it.