Changing the <TargetFrameworkVersion>
isn't enough, the build tools still use the .NET 4 version that's installed on your machine. Something you can see by running ildasm.exe on the generated assembly. Double click the manifest to see:
// Metadata version: v4.0.30319
...
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.hash = (DD 9E C9 8D BF 2A 2D C2 AA 2D C3 8B 51 CD 4C A6 // .....*-..-..Q.L.
15 F0 22 F6 ) // ..".
.ver 2:0:0:0
}
...
.assembly extern mscorlib as mscorlib_4
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.hash = (47 6E C0 E3 BA CD CE B1 9A 4D 68 BE 29 75 61 6F // Gn.......Mh.)uao
BE 04 C6 BA )
.ver 4:0:0:0
}
Note how both versions of mscorlib.dll ended up as a dependency. The problem you encountered.
The feedback article I linked recommended changing the toolset to "v90". This however doesn't work on my machine, even though I have VS2008 installed. The option doesn't show up in the combobox dropdown and when I force it I get this build error:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(43,5): error MSB8020: The builds tools for Visual Studio 2008 (Platform Toolset = 'v90') cannot be found. To build using the v90 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2008 to build using the Visual Studio 2008 build tools.
Following the advice given in the error message, I get this:
------ Update VC++ projects started -------
Updating project 'ConsoleApplication74'...
Configuration 'Debug|Win32': changing Platform Toolset to 'v110' (was 'v90').
Configuration 'Release|Win32': no update required. Platform Toolset is 'v110'.
TargetFrameworkVersion = v4.5 (was v2.0)
Back to square one. I'd say that targeting .NET 2.0 in C++/CLI projects with VS2012 is a lost cause.