Hi,
I've created a custom editor using the Visual Studio 2005 SDK
Integration Package wizard. I modified the editor pane to be a
DataGridView (instead of a text box). The user is expected to manually
add data to the grid.. and it is not connected to any database. I did
bind the DataGridView to a DataTable so that I could easy save and load
the data in XML format.
The next step in my solution requires me to generate some a custom C#
class based on the information entered in the table. I also need for
this class to be associated with my original file in the same was a
Designer.Cs is associated (almost like a child file) with a resx file.
Now I could have my editor generate the class when the data table
changes. However I can't figure out how to associate the generated file
with the original file. Anyone done something like this?
I could also write a custom tool to generate the code (this gives me
the association for free).. but i'd rather not do so as I don't want my
users to know yet another "detail" about the environment that I am
creating. However, I did play with this approach but I couldn't get a
custom too to update without having to save the file. Does anyone know
what event causes the BaseCodeGenerator to get called?
thanks,
Anand
"Ed Dore [MSFT]" - 13 Jan 2006 19:43 GMT
Hi Anand,
It sounds like you want the functionality of a single file generator
(IVsSingleFileGenerator) here. Given that you're asking about the
BaseCodeGenerator class, I'm assuming you're already familiar with this.
There is a new SingleFileGenerator sample included with the December CTP
drop of the Visual Studio SDK, that you might find helpful.
To force the Generate call, you will need to either save the file in
question, or use the VSProjectItem.RunCustomTool() method. For that you'd
have to retrieve the EnvDTE.ProjectItem associated with the file your
editor was operating on, then convert it to a VSProjectItem.
EnvDTE.ProjectItem projItem = RetrieveMyProjectItem();
VSLangProj.VSProjectItem vsProjItem = projItem.Object As
VSLangProj.VSProjectItem;
Sincerely,
Ed Dore [MSFT]
This post is 'AS IS' with no warranties and confers no rights.