Visual Studio 2010 project upgrade bug; test assemblies being copied to release folders in error

Published Fri, Jul 3 2009 8:08

After I upgraded an ASP.NET Web Application VS2008 solution to VS2010 I found a strange problem. When I build either the whole solution or the test project in the solution the test assembly gets copies to Web Applications bin directory. However if I build the solution from the command line with MSBUILD they are not copied (so MSBUILD behaves as VS2008 used to).

Turns out it is easy to repeat, the process is as follows:

  1. Open Vs2008 SP1
  2. Create an empty solution
  3. Add a C# Class library project (targeted on .NET 3.5)
  4. Add a C# ASP.NET Web application (targeted on .NET 3.5)
  5. Add reference from the web application to the class library
  6. Build the solution, note that we see the class library and web application assemblies are in the web application bin directory
  7. Add a C# Test project 3.5 (targeted on .NET 3.5)
  8. Add reference to the Web application project
  9. Build the solution, note that we still just see the class library and web application assemblies are in the web application bin directory – there is no test assembly
  10. Exit VS2008 and load VS2010
  11. Load the solution and allow it to be upgraded. On the dialog about .NET versions say to leave the projects on .NET 3.5.
  12. Rebuild the solution and note that now in the Web Application bin directory we have the class library, web application and test assemblies
  13. Do a clean of the solution, note that in the Web Application bin directory the test assembly is not removed.

So why is this a problem? .NET 4.0 is a replacement for previous .NET version not an extension as 3.0 and 3.5. were for 2.0. This means basically that in any given deployment you need to have all 4.0 assemblies or all 2.0, 3.0, 3.5 ones. However, under VS2010 a test project must target .NET 4.0 (to get all the new cool testing features), so the fact at this 4.0 test assembly ends up in a 3.5 based Web Application directory is a problem.

I have no answer to the problem as yet, though I have reported it. At present the workaround is to either

  1. Delete the test assemblies from the Web Application bin directory. once this is done everything behaves as you would expect.
  2. Or make sure you only target .NET 4.0, though I suspect this might be an issue for some people developing web applications as it will be a while before we see ISP deploying .NET 4.0

Read the complete post at


This Blog





Email Notifications


  • This site is a mirror of