Share via


Project corruption after upgrade VSTSDB & Unit tests

As it was hard to find the cause of this error and the answer, I wanted to share some searchable information on the internet for that. The following problem occurs while doing an upgrade of “older” VSDB project to the new GDR releases. As you have seen, the version of some assemblies within the GDR changed from 9.0.0.0 to 9.1.0.0. During a project upgrade you find yourself in one of the following errors:

 

clip_image002

 

(For search sake the error reads “Cannot add a ConfigurationSection with the same name that already exists.”)

Or the error

“The service Microsoft.VisualStudio.Shell.Interop.ISelectionContainer already exists in the service container.”

which was already mentioned in one of my previous blog entries.

They occur either during opening the project or using anything around Unit Test like Changing the “Database Test configuration”.

The problem is that some references are not set right in the dbproj files. See also the post from Jamie here:

https://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/9057bf45-6058-43c6-856a-19d84337a4c9

Simply change the part of

 

    <configSections>

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

    </configSections>

to -->

    <configSections>

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

    </configSections>

and

Search/replace all instances of ‘Microsoft.VisualStudio.TeamSystem.Data.UnitTesting;’ with ‘Microsoft.Data.Schema.UnitTesting;’

Search/replace all instances of ‘using Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions;’ with ‘’

Search/replace all instance of ‘Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.’ with ‘Microsoft.Data.Schema.UnitTesting.’

This fixes the problem and let you do your normal work again.

-Jens