Migrate MsTest of database edition to VS2010

I have a VS2008 project that is being converted to VS2010. This solution has a MsTest test project used to run database test against a Database project. After conversion you need to target the 4.0 framework for the test project, you run the test and you get

Microsoft.Build.BuildEngine.InvalidProjectFileException: Microsoft.Build.BuildEngine.InvalidProjectFileException: The expression “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\[email protected]” cannot be evaluated.. Aborting test execution

This is due to the fact that the test project probably references old version of the Microsoft.Data.Schema and Microsoft.Data.Schema.UnitTesting dll, just verify that you are using the correct version, simply remove the above two dll from references and add them again using the right version.


Figure 1: reference rigth database testing dll for MSTest

this is not enough, because you need also to go to app.config and change the version of the database test related configuration section

<section name="DatabaseUnitTesting"
type="Microsoft.Data.Schema.UnitTesting.Configuration.DatabaseUnitTestingSection, Microsoft.Data.Schema.UnitTesting,
Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

As you can see the Version should be changed to because you should have (the one related to VS2008 database testing tools)

Now all of your test should run fine again.