问题描述
我正在使用System.CodeDom.Compiler.CodeDomProvider在我的桌面应用程序中动态生成一些代码。
代码生成如下。
var provider = System.CodeDom.Compiler.CodeDomProvider。 CreateProvider(CSharp);
CompilerResults cr = provider.CompileAssemblyFromSource(compileParams,textCode);
我已经读过CSharp提供程序只是CSC.exe上的一个包装器,与Roslyn不同,后者将编译器功能公开为汇编功能。
问题:如果我'使用System.CodeDom命名空间生成代码,是否意味着运行此应用程序的客户端桌面必须安装.NET SDK,以便应用程序可以调用CSC.exe。
同样,如果Roslyn用于生成程序集,我是否需要将Roslyn程序集作为应用程序的一部分部署/复制到客户端桌面?
我尝试过:
写了一个使用Roslyn和Code Dom的示例应用程序。
I'm using System.CodeDom.Compiler.CodeDomProvider to generate some code dynamically in my desktop application.
The code is generated as following.
var provider = System.CodeDom.Compiler.CodeDomProvider.CreateProvider("CSharp");
CompilerResults cr = provider.CompileAssemblyFromSource(compileParams, textCode);
I have read that the CSharp provider is just a wrapper on top of CSC.exe unlike Roslyn which exposes compiler features as an assembly functionality.
Question: If I'm using System.CodeDom namespace to generate code, does it mean that the client desktop where this application will run must have .NET SDK installed so the application can call CSC.exe.
Similarly, If Roslyn was being used to generate assembly, do I need to deploy/copy Roslyn assemblies as part of my application to the client desktop?
What I have tried:
Wrote a sample application which uses Roslyn and Code Dom.
推荐答案
这篇关于我是否需要在客户端安装.NET SDK才能使encodeom工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!