As many of you must have observed that you can associate a custom tool with a project item using CustomTool property in properties window. 

 

So the question is how do you accomplish this, without any user interaction, for project items added via 'Add New Item' and 'Add Existing Item'.

 

Very easy I say. In the registry, under HKLM\Software\Microsoft\VisualStudio\8.0\Generators\{package_guid}, you should make a subkey with name same as the extension for which you want a generator assigned automatically.  The extension should have a leading dot, e.g., ".xml".  The default value of this key is the name of the generator you want to associate with .xml files, e.g., MSDataSetGenerator.

 

Hope that helps! Happy extending Visual Studio

 

Regards

Dr. eX