Bas said:
vesuvius said:
*snip*

I'm automating some of our application-building, which involves adding several  pages to a project and then modifying them based on certain stuff. Changing the title, adding controls, that sort of stuff. The EnvDTE namespace allows for this sort of stuff with classes, but not ASPX pages, it seems. So instead I figured I'd manipulate the ASPX file through Linq to XML because that's pretty convenient with XML, but now I have to figure out something more unwieldy.

I might read the aspx into memory, remove the page directive, feed it to an XDocument, manipulate it, write it back and then manually add the page directive back, but that somehow seems error-prone.

I wouldn't recommend that, because the <% %> tags won't parse with XDocument.