欢迎光临
我们一直在努力

如何 动态编译自己写的代码-.NET教程,面向对象编程

建站超值云服务器,限时71元/月

csharpcodeprovider _coder=new csharpcodeprovider();

icodecompiler complier=_coder.createcompiler();

compilerparameters _par=new compilerparameters();

_par.generateexecutable=true;

_par.outputassembly="sy1.exe";//设置应用程序名

_par.mainclass="sy1";//设置主类

_par.includedebuginformation=true;

foreach(assembly asm in appdomain.currentdomain.getassemblies())

{

_par.referencedassemblies.add(asm.location);

}

string get_code=_code;

compilerresults _res=complier.compileassemblyfromsource(_par,get_code);

if(_res.errors.count>0)

{

errinfo pei=new errinfo();

pei.show();

listbox getlist=pei.getlist;

foreach(compilererror err in _res.errors)

{

getlist.items.add(err.errortext);

}

}

else

{

messagebox.show("success");

}

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 如何 动态编译自己写的代码-.NET教程,面向对象编程
分享到: 更多 (0)

相关推荐

  • 暂无文章