![](/img/trans.png)
[英]How to compile and execute a user defined formula dynamically (runtime) in c#?
[英]How to compile & execute text in c#?
我正在使用 Cosmos 開發操作系統,我想知道是否有辦法從文件中編譯文本,例如:helloworld.cs,然后執行該文件。 提前致謝。
如果要編譯 c# 文件 (.cs),如 Windows 中的helloworld.cs
namespace test {
class test {
static void Main(string[] args) {
System.Console.WriteLine("Hello World");
}
}
}
您可以使用csc.exe
編譯該文件
C:\Windows\Microsoft.NET\Framework\{version}\csc.exe pathToFile
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.