开发者

C# CodeDom Multiple CompilerOptions

开发者 https://www.devze.com 2023-03-21 21:07 出处:网络
I would like to add multiple CompilerOptions with CodeDom, 开发者_运维知识库but I cannot figure out how to do so.

I would like to add multiple CompilerOptions with CodeDom, 开发者_运维知识库but I cannot figure out how to do so.

What I am currently trying:

CompilerParameters cp = new CompilerParameters(referencedAssemblies, "executable file path", false);

cp.CompilerOptions = "/unsafe";
cp.CompilerOptions = "/t:winexe";

The issue is that only the latter of the two parameters is being incorporated into the output executable file. Is there some way to add CompilerOptions parameters as an array?

Thank you for any help,

Evan


Based on the usage I'm guessing you can do something like

cp.CompilerOptions = "/unsafe /t:winexe";

If you wanted to build that string up in an array you would just need to loop over the array that holds the compiler options and append them to a string. Then assign that string to cp.CompilerOptions

MSDN http://msdn.microsoft.com/en-us/library/system.codedom.compiler.compilerparameters.compileroptions.aspx

0

精彩评论

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

关注公众号