|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Automated Refactoring w/ CodeDom and VBCodeProvider...- Reads a VB.Net source file - Parses it into it's constuent parts - Evaluates and modifies as required - Saves the source I thought that the CodeDom and the VBCodeProvider would be the way to go. I can gen code and compile it, but I can not figure out how to parse a VB.Net file into a CodeCompileUnit. (Neither CreateParser or Parse seems to work) How to I read a VB.Net source file into theee code dom so that I can progaramatically inspect it. Am I going down the wrong path? Jack Stephenson Look #d sources. It has some refactoring support.
Show quoteHide quote "jack" <jack.stephen***@lycos.com> wrote in message news:1139206053.926180.31980@z14g2000cwz.googlegroups.com... > Trying to make a utility that > > - Reads a VB.Net source file > - Parses it into it's constuent parts > - Evaluates and modifies as required > - Saves the source > > I thought that the CodeDom and the VBCodeProvider would be the way to > go. > > I can gen code and compile it, but I can not figure out how to parse a > VB.Net file into a CodeCompileUnit. (Neither CreateParser or Parse > seems to work) > > How to I read a VB.Net source file into theee code dom so that I can > progaramatically inspect it. > > Am I going down the wrong path? > > Jack Stephenson > Hi Jack,
I'm not sure about the CodeDom and VBCodeProvider, but using the extensibility model of Visual Studio you can create either: - A macro - An add-in - A Visual Studio package (VSIP / VS 2005 SDK). The extensibility model offers ProjectItem.FileCodeModel, which in turn offers FileCodeModel.CodeElements, etc. See for example my article: HOWTO: Navigate the code elements of a file from a Visual Studio .NET macro or add-in http://www.mztools.com/articles/2006/MZ008.htm You have lots of resources to get you started on my web site ("For add-in developers"). -- Show quoteHide quoteBest regards, Carlos J. Quintero MZ-Tools: Productivity add-ins for Visual Studio You can code, design and document much faster: http://www.mztools.com "jack" <jack.stephen***@lycos.com> escribió en el mensaje news:1139206053.926180.31980@z14g2000cwz.googlegroups.com... > Trying to make a utility that > > - Reads a VB.Net source file > - Parses it into it's constuent parts > - Evaluates and modifies as required > - Saves the source > > I thought that the CodeDom and the VBCodeProvider would be the way to > go. > > I can gen code and compile it, but I can not figure out how to parse a > VB.Net file into a CodeCompileUnit. (Neither CreateParser or Parse > seems to work) > > How to I read a VB.Net source file into theee code dom so that I can > progaramatically inspect it. > > Am I going down the wrong path? > > Jack Stephenson > jack wrote:
Show quoteHide quote > Trying to make a utility that There is currently no VB.NET or C# code parser => CodeCompileUnit > > - Reads a VB.Net source file > - Parses it into it's constuent parts > - Evaluates and modifies as required > - Saves the source > > I thought that the CodeDom and the VBCodeProvider would be the way to > go. > > I can gen code and compile it, but I can not figure out how to parse a > VB.Net file into a CodeCompileUnit. (Neither CreateParser or Parse > seems to work) > > How to I read a VB.Net source file into theee code dom so that I can > progaramatically inspect it. > > Am I going down the wrong path? > > Jack Stephenson > function in the BCL. You would have to write your own CodeParser - which I've considered myself :) |
|||||||||||||||||||||||