By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,975 Members | 1,559 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,975 IT Pros & Developers. It's quick & easy.

Automated Refactoring w/ CodeDom and VBCodeProvider...

P: n/a
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

Feb 6 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Look #d sources. It has some refactoring support.

"jack" <ja*************@lycos.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.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

Feb 6 '06 #2

P: n/a
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").

--

Best 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" <ja*************@lycos.com> escribió en el mensaje
news:11*********************@z14g2000cwz.googlegro ups.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

Feb 7 '06 #3

P: n/a
jack wrote:
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


There is currently no VB.NET or C# code parser => CodeCompileUnit
function in the BCL. You would have to write your own CodeParser -
which I've considered myself :)
Feb 17 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.