The ShapeApp examples demonstrate adding methods to the VSTA project, by calling 'IVstaProjectHostItem.AddMethod'. This lets you pass a method, defined as a CodeDOM tree, to VSTA and add it to the currently loaded project. We are OK with this, and have incorporated it into our prototype application.
However, we also need to be able to get code from the VSTA project, update it, and then pass it back to VSTA. Ideally, we would like to obtain an entire method as a CodeDOM tree. Having done this, we would change the method (i.e. add new statements, remove existing statements, etc), and then pass the updated method back to the VSTA project. The IVstaProjectHostItem interface does not seem to allow this.
I hope the above is clear. Basically, our problem is that the IVstaProjectHostItem interface allows you to add a new method, but we also need to:
1 - get an existing method (preferably as a CodeDOM tree);
2 - having changed the method as required, update it in VSTA.
Am I missing something obvious? Is there a way of obtaining an existing method, and then updating (i.e. replacing) it?
At present, we can add a new method to a VSTA project, but we have no way of finding out anything at all about the methods, properties, etc which are already in the project.