0

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

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.