How to: Upgrade a Custom Test Condition from a Previous Release
This topic applies to Visual Studio Premium and Visual Studio Ultimate, but not to Visual Studio 2010 Professional or the Visual Studio Express versions.
In order for an existing test unit condition that you created in an earlier version of Visual Studio to work correctly, you must upgrade it. Doing so requires the following steps:
To update the project references
(Visual Basic only) In Solution Explorer, click Show All Files.
In Solution Explorer, expand the References node.
Right-click the previous Microsoft.Data.Schema.UnitTesting reference and click Remove.
In Solution Explorer, right-click the References node and click Add Reference.
On the Project menu, click Add Reference.
The Add Reference dialog box appears.
Click the .NET tab. In the Component Name list, select Microsoft.Data.Schema and Microsoft.Data.Schema.UnitTesting, and then click OK.
Your test condition is now using the current reference.
Next, you must verify that your test condition classes have the extension compatibility attribute, as shown in the following procedure. When you define a feature extension, you declare the compatibility of that extension with either a specific database schema provider (DSP) or a base database schema provider, so that the extension is loaded only for appropriate project types. For more information about the extension compatibility attribute, see Extending the Database Features of Visual Studio.
To add an extension compatibility attribute
Add the database service provider extension compatibility attribute, as shown in the following example:
<DatabaseServicesProviderCompatibility (GetType(DspCompatibilityCategory.None))> _ <DisplayName("NewTestCondition")> _ Public Class NewTestCondition Inherits TestCondition End Class
In an earlier version of Visual Studio, you were required to install your test condition into the global assembly cache. In this release of Visual Studio Premium or Visual Studio Ultimate, the registration process has changed, as shown in the following procedures. For more information, see How to: Register and Manage Feature Extensions.
Once your updated references are in place, verify that your assembly is signed and compiled.
The next step is to gather the assembly information generated in the project, including the version, the culture, and the PublicKeyToken, to facilitate registering the custom extension assembly.
To gather assembly information
Once your updated references are in place and the extension compatibility attribute has been added, as shown in the previous procedures, verify that your assembly is signed and compiled.
On the View menu, click Other Windows, and then click Command Window to open the Command window.
In the Command window, type the following code. For FilePath, substitute the path and file name of your compiled .dll file. Include the quotation marks around the path and file name.
By default, the path of your compiled .dll file is SampleGenerator\bin\Debug.
Press Enter. The line should resemble the following with your specific PublicKeyToken:
" GeneratorDateRanges, Version=18.104.22.168, Culture=neutral, PublicKeyToken=nnnnnnnnnnnnnnnn"
Notate or copy this assembly information; it will be used in the next procedure.
Next, you will create an XML file by using the assembly information that you gathered in the previous procedure.
To create the XML file
In Solution Explorer, select the project.
On the Project menu, select Add New Item.
The Add New Item dialog box appears.
In the Templates pane, locate and select the XML File item.
In the Name text box, enter an applicable name and click the Add button.
The XML file is added to the project in Solution Explorer.
You must use the name of your dll (in this case, "myDllName" followed by ".Extensions.xml") for the assembly to register correctly.
Open the XML file and update it to match the XML code later in this procedure. Replace the assembly's version, culture, and PublicKeyToken that you retrieved in the previous procedure.
<?xml version="1.0" encoding="utf-8"?> <extensions assembly="" version="1" xmlns="urn:Microsoft.Data.Schema.Extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:Microsoft.Data.Schema.Extensions Microsoft.Data.Schema.Extensions.xsd"> <extension type=" myDllName.myClassName" assembly="myDllName, Version=22.214.171.124, Culture=neutral, PublicKeyToken=nnnnnnnnnnnnnnnn" enabled="true"/> </extensions>
On the File menu, click Save All.
Next, you will copy the assembly and XML file to the Extensions directory. When Visual Studio Premium starts, it will identify any extensions in the <Microsoft Visual Studio 10.0>\VSTSDB\Extensions directory and subdirectories and register them for use in the session.
To copy and register the assembly and XML file to the Extensions directory
Create a new folder named CustomGenerators in the <Microsoft Visual Studio 10.0>\VSTSDB\Extensions\ directory.
Copy the assembly file from the My Documents\Visual Studio 2008\Projects\<projectName>\<projectName>\bin\Debug\ directory to the <Microsoft Visual Studio 10.0>\VSTSDB\Extensions\CustomGenerators directory that you created.
Copy the XML file from the My Documents\Visual Studio 2008\Projects\<projectName>\<projectName>\ directory to the <Microsoft Visual Studio 10.0>\VSTSDB\Extensions\CustomGenerators directory that you created.
A best practice is to put your extension assemblies in a folder in the <Microsoft Visual Studio 10.0>\VSTSDB\Extensions directory. This will help you identify which extensions were included with the product, and which ones are your custom creations. Folders are also recommended for organizing your extensions into specific categories.