473,472 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Automated Refactoring w/ CodeDom and VBCodeProvider...

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
3 2690
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ron Bullman | last post by:
Hi, I havent been able to find any documentation about @ in the CodeDom context. The problem is when generating C# code from CodeDom it will associate a @-tag with all C# specific types. Why?...
2
by: João Santa Bárbara | last post by:
Hi all i have a CodeStatementCollection, and i want to see what's in each line ex: dim x as object = new XXXobject x.myproperty=100 and so one .. can someone help me ??? thks
2
by: Guillaume | last post by:
I don't think I'm the only one with this challenge so… I made code with the CodeDom classes and made code to create a new solution and a new project Now I want to get the codedom code in the new...
1
by: John Livermore | last post by:
Hello, We have an application that uses CodeDom for dynamic in-memory compilation of code. The same code (library) is used by both an ASP.net web site and a Windows Service. The code runs fine...
3
by: jack | last post by:
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...
0
by: Michael Jenck | last post by:
Hi All, I have been playing with the codedom and can't get it to output for option compare Binary with a CodeCompileUnit. I have searched the web and Don't now if it's possible. If it's not...
1
by: =?Utf-8?B?QU1lcmNlcg==?= | last post by:
I may have painted myself into a corner with GenerateInMemory=true. My app need a custom user step. Users want to code (sort of - they are not programmers) some refinements to a search...
7
by: Jeff | last post by:
Hey ..NET 2.0 I'm on a project where I'm now about to develop the Data Access Layer. The database have 300 stored procedures. I'm about to go on a time consuming process of writing the .NET...
0
by: news.microsoft.com | last post by:
When I compile the following code, it works fine only one time. At the second time the following error occurs. Can somebody help me? vbc : Command line (0,0) : error BC2006: option 'r'...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.