Debugging a Custom Schema Provider

The first step to debugging a Custom Schema Provider is to make sure your project is set to compile in Debug mode as opposed to Release mode.  The next step is to set a Start Up application so some of your break points inside of your Custom Schema Provider get hit while running CodeSmith Generator. To do this you will want to go into the Project's Properties page by right clicking the Project in Solution Explorer and selecting Properties. Next, navigate to the Debug tab and set the Configuration drop down list to All Configurations. Next, under the Start Action Section, choose the Start External Program. You will want to browse for the application you want to test the Custom Schema Provider with. In almost every case you will want to check out the Custom Schema Provider with CodeSmith Generator Explorer (C:\Program Files\CodeSmith\<Version>\CodeSmith.exe). 

Please configure the Build Directory before debugging to ensure your breakpoints are hit and your latest changes take effect.

Please note that if you are debugging an existing Schema Provider that ships with Generator, you will need to change the providers assembly file name (project tab) as well as the value returned by the providers for the IDbSchemaProvider.Name property.

Next, set a break point in your project and start debugging!

You can also debug a Schema Provider that ships with Generator. Please follow the steps below when debugging an official Schema Provider.

  1. Open the existing Schema Providers Visual Studio project file with Visual Studio. This should be located in the following directory: Documents\CodeSmith Generator\Samples\<Version>\Projects\CSharp\
  2. Fix any broken assembly references.
  3. Append a value (E.G., Custom) to the end of the class name, compiled assembly name (via project settings page) as well as the value returned, by the providers Name property.