How to: Register Custom Data Generators

After you have authored a custom generator, you must register it on your computer before Data Generator can use it. To register a generator, you must sign the .dll file with a strong name and copy the .dll file to the Private Assemblies folder or the global assembly cache. You must also create an Extensions.xml file.

To register a custom generator

  1. Open your completed data generator project.

  2. In Solution Explorer, right-click the project to open the Properties page.

  3. On the Signing tab, select the Sign the assembly check box, and type a name for the key file to sign the assembly with a strong name. For more information, see How to: Sign an Assembly with a Strong Name.

  4. On the View menu, click Other Windows,and then click Command Window to open the Command window.

  5. 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.

    Note

    By default, the path of your compiled .dll file is YourSolutionPath\bin\Debug or YourSolutionPath\bin\Release.

    ? System.Reflection.Assembly.LoadFrom("FilePath").FullName
    
    ? System.Reflection.Assembly.LoadFrom(@"FilePath").FullName
    
  6. Press ENTER.

  7. Copy the resultant line to the Clipboard. The line should resemble the following:

    "GeneratorAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nnnnnnnnnnnnnnnn"
    
  8. Open a plain-text editor, such as Notepad.

  9. Provide the following information, specifying your own assembly name, public key token, and extension type, by using the information that you copied in a previous step:

    <?xml version="1.0" encoding="utf-8" ?> 
      <extensions assembly="GeneratorAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=TokenKey" version="1" xmlns="urn:Microsoft.VisualStudio.TeamSystem.Data.Extensions" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:Microsoft.VisualStudio.TeamSystem.Data.Extensions Microsoft.VisualStudio.TeamSystem.Data.Extensions.xsd">
      <extension type="GeneratorNamespace.GeneratorClassName" enabled="true" /> 
      </extensions>
    

    Note

    The extension type is of the form "namespace.classname". The assembly name does not contain the ".dll" extension.

  10. Save the file by using the following information:

    File name

    TestGenerator.Extensions.xml

    Location

    [Program Files]\Microsoft Visual Studio 9.0\DBPro

  11. Copy your compiled .dll file to the following location:

    Location

    [ProgramFiles]\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies

  12. Close Visual Studio.

  13. Re-open Visual Studio.

    Your generator is registered and ready to use.

Security

For more information, see Security of Data Generators.

See Also

Tasks

How to: Create Custom Data Generators

Walkthrough: Creating a Custom Data Generator