Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Compiling C# Code at runtime

Compiling C# Code at runtime

Scheduled Pinned Locked Moved C#
questioncsharp
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sumit Domyan
    wrote on last edited by
    #1

    Hi All Can i compile C# code at runtime? If yes how? And how can i use it in my code? Thanks & Regards Sumit Domyan

    T S E 3 Replies Last reply
    0
    • S Sumit Domyan

      Hi All Can i compile C# code at runtime? If yes how? And how can i use it in my code? Thanks & Regards Sumit Domyan

      T Offline
      T Offline
      tom_dx
      wrote on last edited by
      #2

      why? look into c# scripting IM PROUD TO BE A GMAIL;

      1 Reply Last reply
      0
      • S Sumit Domyan

        Hi All Can i compile C# code at runtime? If yes how? And how can i use it in my code? Thanks & Regards Sumit Domyan

        S Offline
        S Offline
        S Senthil Kumar
        wrote on last edited by
        #3

        You need to look under the Microsoft.CSharp namespace. You can use the CSharpCodeProvider class and get a compiler using the CreateCompiler method. Something like (From MSDN)

        // Create an instance of the CSharpCodeProvider class.
        Microsoft.CSharp.CSharpCodeProvider provider = new CSharpCodeProvider();
        // Call the CodeDomProvider.CreateCompiler() method to obtain an ICodeCompiler from the provider.
        System.CodeDom.Compiler.ICodeCompiler compiler = provider.CreateCompiler();
        compiler.CompileAssemblyFromFiles(...);

        Regards Senthil _____________________________ My Blog | My Articles | WinMacro

        1 Reply Last reply
        0
        • S Sumit Domyan

          Hi All Can i compile C# code at runtime? If yes how? And how can i use it in my code? Thanks & Regards Sumit Domyan

          E Offline
          E Offline
          eggie5
          wrote on last edited by
          #4

          Technically, isn't C# code complied at run time? /\ |_ E X E GG

          S 1 Reply Last reply
          0
          • E eggie5

            Technically, isn't C# code complied at run time? /\ |_ E X E GG

            S Offline
            S Offline
            S Senthil Kumar
            wrote on last edited by
            #5

            Not really, it's IL that's compiled at runtime. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups