473,387 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 2686
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.