2 // System.CodeDom.Compiler.CompilerParameters.cs
5 // Daniel Stodden (stodden@in.tum.de)
6 // Andreas Nahr (ClassDevelopment@A-SoftTech.com)
8 // (C) 2002 Ximian, Inc.
9 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System.Collections.Specialized;
32 using System.Runtime.InteropServices;
33 using System.Security.Permissions;
34 using System.Security.Policy;
36 namespace System.CodeDom.Compiler {
43 [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
44 [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
45 public class CompilerParameters {
47 private string compilerOptions;
49 private Evidence evidence;
51 private bool generateExecutable = false;
52 private bool generateInMemory = false;
53 private bool includeDebugInformation = false;
54 private string mainClass;
55 private string outputAssembly;
56 private StringCollection referencedAssemblies;
57 private TempFileCollection tempFiles;
58 private bool treatWarningsAsErrors = false;
59 private IntPtr userToken = IntPtr.Zero;
60 private int warningLevel = -1;
61 private string win32Resource;
63 private StringCollection embedded_resources;
64 private StringCollection linked_resources;
70 public CompilerParameters()
74 public CompilerParameters (string[] assemblyNames)
76 referencedAssemblies = new StringCollection();
77 referencedAssemblies.AddRange (assemblyNames);
80 public CompilerParameters (string[] assemblyNames, string output)
82 referencedAssemblies = new StringCollection();
83 referencedAssemblies.AddRange (assemblyNames);
84 outputAssembly = output;
87 public CompilerParameters (string[] assemblyNames, string output, bool includeDebugInfo)
89 referencedAssemblies = new StringCollection();
90 referencedAssemblies.AddRange (assemblyNames);
91 outputAssembly = output;
92 includeDebugInformation = includeDebugInfo;
98 public string CompilerOptions {
100 return compilerOptions;
103 compilerOptions = value;
111 public Evidence Evidence {
112 get { return evidence; }
113 [SecurityPermission (SecurityAction.Demand, ControlEvidence = true)]
114 set { evidence = value; }
118 public bool GenerateExecutable {
120 return generateExecutable;
123 generateExecutable = value;
127 public bool GenerateInMemory {
129 return generateInMemory;
132 generateInMemory = value;
136 public bool IncludeDebugInformation {
138 return includeDebugInformation;
141 includeDebugInformation = value;
145 public string MainClass {
154 public string OutputAssembly {
156 return outputAssembly;
159 outputAssembly = value;
163 public StringCollection ReferencedAssemblies {
165 if (referencedAssemblies == null)
166 referencedAssemblies = new StringCollection ();
168 return referencedAssemblies;
172 public TempFileCollection TempFiles {
174 if (tempFiles == null)
175 tempFiles = new TempFileCollection ();
183 public bool TreatWarningsAsErrors {
185 return treatWarningsAsErrors;
188 treatWarningsAsErrors = value;
192 public IntPtr UserToken {
201 public int WarningLevel {
206 warningLevel = value;
210 public string Win32Resource {
212 return win32Resource;
215 win32Resource = value;
220 public StringCollection EmbeddedResources {
222 if (embedded_resources == null)
223 embedded_resources = new StringCollection ();
224 return embedded_resources;
229 public StringCollection LinkedResources {
231 if (linked_resources == null)
232 linked_resources = new StringCollection ();
233 return linked_resources;