Visual Studio XGen - Tips & Tricks
There's a few simple things which can be good to know sooner rather than later:
  1. If the readability of your generated code is bad and you want to read it for some reason, then don't spend time trying to fix indentation in your templates. Instead, select all and use the formatter that is built in in in Visual Studio. In short, type Ctrl-A, Ctrl-K, F. If your file is of a type that the formatter understands your code is now formatted better.
  2. Some of the files generated in different places are already XML. The .xsd file (the Dataset file) is already in XML. You can use that to generate code. You can drag and drop a table from a database into a dataset and it will create an XML representation for that table. It isn't perfect, but at least it is something. Your app.config (or web.config) is also XML. WSDL is XML.
  3. Some characters have a special meaning in XML. If you want a less than sign in your output, whether you use it in your xtemplate or in your xsource file you have to use special escape sequences.
    For <, type &lt; (note the ampersand and the semicolon). 
    For > type &gt; 
    For & type &amp;
    
  4. To remove the xml header <?xml version="1.0" encoding="utf-8" ?> at the top of the output document, place this: <output method="text" /> In your stylesheet, at the top level, like this:
    <stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform"> 
    <output method="text" />
    ...
    
  5. You can create a shortcut to Tools -> Transform if you are a keyboard jockey. You do this by clicking Tools -> Options. Then choose Keyboard in the Environment folder. In the field called "show commands containing:", type in vsxgen. Select Transfrom. Then click on the "Press shortcut key(s):" field and press for instance Ctrl-Shift-X and then assign. If you are using the default keyboard mapping scheme you will be asked to create a new scheme, but that's ok. Go ahead and do that. Now you can use the new shortcut (Ctrl-Shift-X) to generate code.