You may get the following error in Visual Studio 2008 when trying to compile a test project:
Unable to set TestContext property for the class x. System.ArgumentException: Object of type ‘Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext’ cannot be converted to type ‘Microsoft.VisualStudio.TestTools.UnitTesting.TestContext’
This just happened to me and the reason was a reference that pointed to the old assembly of the Visual Studio 2005. The project was just migrated to the new version, but the old reference had remained.
To fix this, follow these steps:
- Remove the old reference (same name as in step 3)
- Go to Project / References…
- Select Microsoft.VisualStudio.QualityTools.UnitTestFramework (version 9.0.0.0!) and Ok
I found the answer to this trivial error from the MSDN Forums.

