Differences between building on a machine with VS2010 installed and on a machine with the 7.1 SDK installed

StackOverflow https://stackoverflow.com/questions/4247437

  •  27-09-2019
  •  | 
  •  

Question

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

Was it helpful?

Solution

When you upgraded your solution to VS2010, did you change the targeted framework? You can look for it by viewing the csproj files in a text editor. Do you have the 7.0a framework in your build server?

EDIT :

I ran into the same problem a while ago and it has something to do with registry key not set. Take a look here : http://connect.microsoft.com/VisualStudio/feedback/details/594338/tfs-2010-build-agent-and-windows-7-1-sdk-targeting-net-3-5-generates-wrong-embedded-resources

I think you need to manually add the registry key HKLM\Software\Microsoft\MsBuild\ToolsVersions\SDK35ToolsPath

OTHER TIPS

I'm not sure if this helps but see this link regarding RequiresFramework35SP1Assembly Task

http://msdn.microsoft.com/en-us/library/ff598689.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top