如何以编程方式构建和从当前项目编译另一个C#项目 [英] How to programatically build and compile another c# project from the current project

查看:171
本文介绍了如何以编程方式构建和从当前项目编译另一个C#项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

程序A:输出一个C#的功能,并插入功能到另一个C#项目B.这些步骤已经实施的文件(例如Classifier.cs)。

Program A: output a c# function, and insert the function into a file (eg. Classifier.cs) in another c# project B. These steps have already been implemented.

我想知道有没有什么办法以编程方式生成和编译项目A.内的C#项目B以便我可以点击项目一个一个按钮,它会自动插入新的功能为项目b,建,编译项目B.最后推出新的b项目。

I am wondering is there any way to programmatically build and compile the the c# project B inside project A. So I can click a button in project A, it will automatically insert the new function into project B, build, compile the project B. And finally launch the new project B.

感谢您。

推荐答案

没有需要执行一个新的进程。 .NET为我们提供了一种方式来编程调用C#编译器。我发现这种方法效果很好:

No need to execute a new process. .NET gives us a way to invoke the C# compiler programatically. I find this technique works well:

http://blogs.msdn.com/b/dohollan/archive/2010/08/09/programmatically-invoke-the-c-compiler.aspx

这篇关于如何以编程方式构建和从当前项目编译另一个C#项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆