开发者

create c# project at runtime

Does any body know how can I create a C# project at runtime, add classes to it and compile it开发者_JAVA百科 to generate a dll.


If you just want to compile code and generate a dll, see cdhowie's answer.

If you want to have a complete project file at the end, you can create a csproj file through XML or Text output, which points to the code (and other) files you want to include, then execute "msbuild myproject.csproj".

Open a .csproj file for a project you have with notepad, the structure isn't complicated.


If you are interested in creating dynamic classes for your own use the have a look at System.Reflection.Emit namespace. You can create assembly full of types on the fly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜