473,320 Members | 2,094 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,320 software developers and data experts.

Compile code at runtime?

OK, I just ran across a program that did this and I am wondering is this
something they coded in themselves, or is there already helper classes, etc
available to assist in this.

The application compiles many C# files at runtime and then uses them.
How easy/hard is it to do such a thing?

Thanks
--
Adam Clauss
ca*****@tamu.edu
Nov 15 '05 #1
1 3953
"Adam Clauss" <ca*****@tamu.edu> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
The application compiles many C# files at runtime and then uses them.
How easy/hard is it to do such a thing?


Hi. Use System.CodeDom.Compiler.ICodeCompiler to instantiate the compiler
you want, eg C# or VB.NET, add references using
System.CodeDom.Compiler.CompilerParameters.Paramet ers.ReferencedAssemblies.A
dd(), then compile it using
System.CodeDom.Compiler.CompileAssemblyFromSource( ).

There's a few details to take care of that I've omitted but it's not too
bad.

-- Alan
Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Baskar RajaSekharan | last post by:
In C-sharp, I wnat to know whether the Component is compiled in Debug Mode or Run Mode through Code. How is it possible? Is there any way to Access the Config file and check? Please let me know...
3
by: Eric Newton | last post by:
I'm wondering if there's a compile time cast gaurantee if any? Given the following: //----- begin sample code public interface IRegion { string Text { get; } RectangleF Area { get; } }
2
by: Glen | last post by:
I'm working on a custom assembly and I'm trying to figure out the best approach to handling known constraints within the assembly, once compiled, to alert the developer at compile time of a...
4
by: Dave Rahardja | last post by:
I have the following program that uses an array of chars to simulate a bit set: --------- // An out-of-bounds exception class BoundsException {}; template <int bits = 1> class Bitset
10
by: Arno R | last post by:
Hi all, Is it possible to execute a command like 'CompileAndSaveAll' at runtime? In a new app I use a codelibrary. (The app is still changing, codelib also) I add this lib to the references at...
4
by: John Smith | last post by:
Hi I'm porting some C++ code to new platforms and have some 1-byte aligned structures which need a specific size. Since datatypes can vary on different platforms (which I found out the hard way...
2
by: Lonewolf | last post by:
hi all, I realize the example on MSDN for IPCChannel has compile error in VS2005 pro. Either I'm missing something or there's something seriously wrong with MSDN on that section. I reproduce the...
2
by: bonk | last post by:
Hello, I am currently trying to wrap my head around what actually happens when I compile a normal (native) c++ class with the /CLR Flag in Visual C++ 2005 (C++/CLI). Suppose I have the...
7
by: wei8010 | last post by:
int fun() { static int x = 1000; return 0; } int main( int argc, char* argv ) { cout<<x<<endl; }
16
by: desktop | last post by:
I have read that using templates makes types know at compile time and using inheritance the types are first decided at runtime. The use of pointers and casts also indicates that the types will...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.