Search code examples
c#.nettfsmsbuild.net-assembly

TFS Build assembly version conflicts


I have a build definition with projects that use different versions of .NET. Some use 4.0 and others use 4.5.

  • Projects for 4.0 use EntityFramework 4.4.
  • Projects for 4.5 use EntityFramework 5.0.

This is giving me a lot of headaches because, while the compilation goes OK, tests won't pass in the build server because the EntityFramework assembly is the incorrect one.

It seems that each project overwrites existing assemblies with the ones it requires in the output folder, so it's a matter of luck that the correct one is loaded to run the tests.

How would I avoid this problem? Can I force the output folder to keep the latest version of EF and put assemblybindings?

Thanks.

EDIT: I've checked the Build Definition based on answers and found this:

EDIT 2: The snapshot corresponds to a template that was migrated from previous versions of TFS, so it doesn't look like the default one. Anyways, the option that I highlighted works for me :) I've marked the question as answered.

Build Definition


Solution

  • You basically have 3 choices, depending on how what you are building will look when it is deployed.

    Option 1 Set the output Location to be PerProject or AsConfigured, this will allow each application to be dropped to it's own folder and then the tests should run independently with the target EF framework. This is good if you will be deploying seperate applications on a per project basis. Build Definition Set Output Location

    Option 2 Leave everything as is and change your build order so that the latest version of EF gets built last, therefore leaving the latest version in the drop folder, you can then add redirects as required

    Option 3 Standardise on a version of EF and update all of the projects to point to the single version.