We have recently upgraded all our VS2008 projects to VS2010. Our code base is still targeting framework version 3.5, but I'm sure most of you would know that test projects must be upgraded to framework version 4.0.
We have one particular set of tests that do not work now that the test project is targeting framework 4.0. These tests all test code that is doing some sort of reflection task. Through a bit of debugging I managed to narrow the problem down.
For some reason in the upgraded test project the following code:
AppDomain.CurrentDomain.GetAssemblies();
will return a reference to "Microsoft.VisualStudio.Enterprise.AspNetHelper". If I then call
GetTypes()
on this assembly I get a ReflectionTypeLoadException saying it can't load assembly "Microsoft.Web.Administration".
So it seems to me that there is some type within "Microsoft.VisualStudio.Enterprise.AspNetHelper" that inherits from or has some reference to another type in Microsoft.Web.Administration. I have done some reading and realise the Administration dll is part of IIS7. I am developing on XP and do not have IIS7 installed.
My real question is - why is Microsoft.VisualStudio.Enterprise.AspNetHelper in my app domain in VS2010 tests but not in VS2008 tests? Creating a simple console app that does the same thing does not seem to be a problem - only with test projects. How do I get around this?