mscorlib(4.0.0.0) API with additions
CompilerResults.cs
2 using System.Reflection;
5 
7 {
10  [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
11  public class CompilerResults
12  {
13  private CompilerErrorCollection errors = new CompilerErrorCollection();
14 
15  private StringCollection output = new StringCollection();
16 
17  private Assembly compiledAssembly;
18 
19  private string pathToAssembly;
20 
21  private int nativeCompilerReturnValue;
22 
23  private TempFileCollection tempFiles;
24 
25  private Evidence evidence;
26 
30  {
31  [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
32  get
33  {
34  return tempFiles;
35  }
36  [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
37  set
38  {
39  tempFiles = value;
40  }
41  }
42 
45  [Obsolete("CAS policy is obsolete and will be removed in a future release of the .NET Framework. Please see http://go2.microsoft.com/fwlink/?LinkId=131738 for more information.")]
46  public Evidence Evidence
47  {
48  [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
49  get
50  {
51  Evidence result = null;
52  if (evidence != null)
53  {
54  result = evidence.Clone();
55  }
56  return result;
57  }
58  [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
60  set
61  {
62  if (value != null)
63  {
64  evidence = value.Clone();
65  }
66  else
67  {
68  evidence = null;
69  }
70  }
71  }
72 
76  {
77  [SecurityPermission(SecurityAction.Assert, Flags = SecurityPermissionFlag.ControlEvidence)]
78  get
79  {
80  if (compiledAssembly == null && pathToAssembly != null)
81  {
82  AssemblyName assemblyName = new AssemblyName();
83  assemblyName.CodeBase = pathToAssembly;
84  compiledAssembly = Assembly.Load(assemblyName, evidence);
85  }
86  return compiledAssembly;
87  }
88  [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
89  set
90  {
91  compiledAssembly = value;
92  }
93  }
94 
97  public CompilerErrorCollection Errors => errors;
98 
101  public StringCollection Output
102  {
103  [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
104  get
105  {
106  return output;
107  }
108  }
109 
112  public string PathToAssembly
113  {
114  [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
115  get
116  {
117  return pathToAssembly;
118  }
119  [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
120  set
121  {
122  pathToAssembly = value;
123  }
124  }
125 
128  public int NativeCompilerReturnValue
129  {
130  get
131  {
132  return nativeCompilerReturnValue;
133  }
134  [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
135  set
136  {
137  nativeCompilerReturnValue = value;
138  }
139  }
140 
143  [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
145  {
146  this.tempFiles = tempFiles;
147  }
148  }
149 }
Describes a set of security permissions applied to code. This class cannot be inherited.
TempFileCollection TempFiles
Gets or sets the temporary file collection to use.
Represents the results of compilation that are returned from a compiler.
static Assembly Load(string assemblyString)
Loads an assembly given the long form of its name.
Definition: Assembly.cs:507
Assembly CompiledAssembly
Gets or sets the compiled assembly.
Definition: __Canon.cs:3
StringCollection Output
Gets the compiler output messages.
Evidence Clone()
Returns a duplicate copy of this evidence object.
Definition: Evidence.cs:1310
Represents a collection of strings.
SecurityAction
Specifies the security actions that can be performed using declarative security.
Represents an assembly, which is a reusable, versionable, and self-describing building block of a com...
Definition: Assembly.cs:22
Ability to provide evidence, including the ability to alter the evidence provided by the common langu...
string CodeBase
Gets or sets the location of the assembly as a URL.
Describes an assembly's unique identity in full.
Definition: AssemblyName.cs:19
CompilerErrorCollection Errors
Gets the collection of compiler errors and warnings.
string PathToAssembly
Gets or sets the path of the compiled assembly.
Defines the set of information that constitutes input to security policy decisions....
Definition: Evidence.cs:17
int NativeCompilerReturnValue
Gets or sets the compiler's return value.
Specifies that the class can be serialized.
SecurityPermissionFlag
Specifies access flags for the security permission object.
Represents a collection of temporary files.
Represents a collection of T:System.CodeDom.Compiler.CompilerError objects.
CompilerResults(TempFileCollection tempFiles)
Initializes a new instance of the T:System.CodeDom.Compiler.CompilerResults class that uses the speci...