Using CodeDom to edit code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Mark Howell

    Using CodeDom to edit code

    BlankCan anyone give me an idea as to how to use the CodeDom to edit code?
    I would like to perform mass changes (such as putting logging messages as
    the first statement in all methods with method names) to a system with
    hundreds of classes and thousands of methods. I know the CodeDom can allow
    you manipulate the code and spit it back out, but I cannot seem to see how
    to get it to pull the code into it in the first place.
    Any ideas, pointers or references would be greatly appreciated!

    --
    John Mark Howell


  • Shakir Hussain

    #2
    Re: Using CodeDom to edit code

    Check this link. Its detailed and simple.


    l/cpconUsingCodeD OM.asp

    Also, check




    --
    Shak
    (Houston)


    "John Mark Howell" <jmarkhowell@ho tmail.com> wrote in message
    news:#4XP83tWEH A.3800@TK2MSFTN GP11.phx.gbl...[color=blue]
    > BlankCan anyone give me an idea as to how to use the CodeDom to edit code?
    > I would like to perform mass changes (such as putting logging messages as
    > the first statement in all methods with method names) to a system with
    > hundreds of classes and thousands of methods. I know the CodeDom can[/color]
    allow[color=blue]
    > you manipulate the code and spit it back out, but I cannot seem to see how
    > to get it to pull the code into it in the first place.
    > Any ideas, pointers or references would be greatly appreciated!
    >
    > --
    > John Mark Howell
    >
    >[/color]


    Comment

    • John Mark Howell

      #3
      Re: Using CodeDom to edit code

      Thanks Shak, but I've already checked out both of those. The MSDN link
      shows how to build a code model from scratch, the CodeProject link is a
      developer written tool that is not yet complete. However, I may be able to
      use the CodeProject tool as a base.

      I verified that in .Net 1.0 and 1.1, all CodeCompiler derivatives return
      null for CreateParser. It was apparently by design and supposedly because
      not all types in all languages can be represented by a particular CodeParser
      object. However, because the code generation for all .Net languages fits
      within the CTS and CLR, I doubt that is the real reason.

      At this point, the only way I can see to build a code model
      (CodeCompileUni t) is to scan the source and add the elements one by one.


      "Shakir Hussain" <shak@fakedomai n.com> wrote in message
      news:OezSzFuWEH A.3972@TK2MSFTN GP12.phx.gbl...[color=blue]
      > Check this link. Its detailed and simple.
      >[/color]
      http://msdn.microsoft.com/library/de...us/cpguide/htm[color=blue]
      > l/cpconUsingCodeD OM.asp
      > Also, check
      > http://www.thecodeproject.com/csharp/codedomparser.asp
      > Shak[/color]


      Comment

      Working...