2

I'm writing a desktop application. It would need to generate c# code on client machines.

I thought of using CodeDOM (complex) or simple string manipulations (fragile). What else? Which way is recommended?

2 Answers 2

6

T4? http://msdn.microsoft.com/en-us/library/bb126445.aspx

Sign up to request clarification or add additional context in comments.

7 Comments

AFAIK I'm not allowed to redistribute it, is it still the case?
@Yaron, what wouldn't you be allowed to distribute?
T4 can be used to generate classes from a template that in turn generate files are runtime, making this a possible option. See this link for more detail msdn.microsoft.com/en-us/library/ee844259.aspx.
If you're talking about runtime code generation, you might want to take a look at the ILGenerator class (IL.Emit()) msdn.microsoft.com/en-us/library/… However, I'm not very familiar with that myself, so won't be able to help you any further than the link :)
I need to generate code at customer environment, not at design time. Does T$ fit this scenario, both technically and legaly?
|
0

If you mean run dynamic code, then: CS-Script is the most mature solution. With CS-Script you could even roll your own template based, custom code generator, like the scripting used by MyGeneration.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.