We are trying to upgrade our code base to use Visual Studio 2010 but are having problems getting everything sorted on our build servers. We do not want to install Visual Studio 2010 on our build servers and so have installed just the .Net 4 framework and SDK (v7.1).
We are still wanting to target the .Net 3.5 platform (we will upgrade to .Net 4 at some point in the future but do not want to just yet).
We have managed to get the code to compile but now we are running into runtime errors like the following.
Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
The problem is that runtime is trying to deserialize the embedded resource and if I look at the resources in reflector, I see that they are all .Net 4.0 objects. For example, the icon of our a windows app is of type System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
.
So it looks like MSBuild is compiling the resources incorrectly (using a different runtime to the target)? I have confirmed this by looking at the diffs of the dll built on my dev machine and that built on the build server - it is clear to see that one dll's resources use 2.0.0.0 version and the other (from the build server) uses 4.0.0.0. The project references are to the v2.0.0.0 dlls in both cases (as one would expect).
Does anyone have any idea as to why MSBuild is compiling the resources as 4.0 objects?
Thanks in advance.
Chris