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;
108 public Evidence Evidence
{
109 get { return evidence; }
110 [SecurityPermission (SecurityAction
.Demand
, ControlEvidence
= true)]
111 set { evidence = value; }
115 public bool GenerateExecutable
{
117 return generateExecutable
;
120 generateExecutable
= value;
124 public bool GenerateInMemory
{
126 return generateInMemory
;
129 generateInMemory
= value;
133 public bool IncludeDebugInformation
{
135 return includeDebugInformation
;
138 includeDebugInformation
= value;
142 public string MainClass
{
151 public string OutputAssembly
{
153 return outputAssembly
;
156 outputAssembly
= value;
160 public StringCollection ReferencedAssemblies
{
162 if (referencedAssemblies
== null)
163 referencedAssemblies
= new StringCollection ();
165 return referencedAssemblies
;
169 public TempFileCollection TempFiles
{
171 if (tempFiles
== null)
172 tempFiles
= new TempFileCollection ();
180 public bool TreatWarningsAsErrors
{
182 return treatWarningsAsErrors
;
185 treatWarningsAsErrors
= value;
189 public IntPtr UserToken
{
198 public int WarningLevel
{
203 warningLevel
= value;
207 public string Win32Resource
{
209 return win32Resource
;
212 win32Resource
= value;
217 public StringCollection EmbeddedResources
{
219 if (embedded_resources
== null)
220 embedded_resources
= new StringCollection ();
221 return embedded_resources
;
226 public StringCollection LinkedResources
{
228 if (linked_resources
== null)
229 linked_resources
= new StringCollection ();
230 return linked_resources
;