mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
Address some feedback
- Name fields more descriptive - Use .AddRange instead of foreach
This commit is contained in:
1 parent
bcac0ece62
commit
7d866679d0
1 file changed
+14
-19
@@ -1059,15 +1059,13 @@ namespace Microsoft.PowerShell.Commands
|
||||
private static PortableExecutableReference ObjectImplementationAssemblyReference =
|
||||
MetadataReference.CreateFromFile(typeof(object).GetTypeInfo().Assembly.Location);
|
||||
|
||||
// This assembly should be System.Runtime.dll
|
||||
private static PortableExecutableReference ObjectDeclaredAssemblyReference =
|
||||
MetadataReference.CreateFromFile(ClrFacade.GetAssemblies(typeof(object).FullName).First().Location);
|
||||
|
||||
// In CoreCLR 1.0.0 RTM, System.Attribute need to be loaded from mscorlib.dll,
|
||||
// not from ObjectDeclaredAssemblyReference.
|
||||
private static PortableExecutableReference AttributeDeclaredAssemblyReference =
|
||||
private static PortableExecutableReference MscorlibAssemblyReference =
|
||||
MetadataReference.CreateFromFile(Assembly.Load(new AssemblyName("mscorlib")).Location);
|
||||
|
||||
// This assembly should be System.Runtime.dll
|
||||
private static PortableExecutableReference SystemRuntimeAssemblyReference =
|
||||
MetadataReference.CreateFromFile(ClrFacade.GetAssemblies(typeof(object).FullName).First().Location);
|
||||
|
||||
// SecureString is defined in a separate assembly.
|
||||
// This fact is an implementation detail and should not require the user to specify one more assembly,
|
||||
// if they want to use SecureString in Add-Type -TypeDefinition.
|
||||
@@ -1076,22 +1074,22 @@ namespace Microsoft.PowerShell.Commands
|
||||
MetadataReference.CreateFromFile(typeof(System.Security.SecureString).GetTypeInfo().Assembly.Location);
|
||||
|
||||
|
||||
// These assemlbies are automatically added to ReferencedAssemblies.
|
||||
// These assemlbies are always automatically added to ReferencedAssemblies.
|
||||
private static PortableExecutableReference[] autoReferencedAssemblies = new PortableExecutableReference[]
|
||||
{
|
||||
ObjectImplementationAssemblyReference,
|
||||
ObjectDeclaredAssemblyReference,
|
||||
AttributeDeclaredAssemblyReference,
|
||||
SecureStringAssemblyReference
|
||||
MscorlibAssemblyReference,
|
||||
SystemRuntimeAssemblyReference,
|
||||
SecureStringAssemblyReference,
|
||||
ObjectImplementationAssemblyReference
|
||||
};
|
||||
|
||||
// These assemlbies are used, when ReferencedAssemblies parameter is not specified.
|
||||
private static PortableExecutableReference[] defaultAssemblies = new PortableExecutableReference[]
|
||||
{
|
||||
ObjectImplementationAssemblyReference,
|
||||
ObjectDeclaredAssemblyReference,
|
||||
AttributeDeclaredAssemblyReference,
|
||||
MscorlibAssemblyReference,
|
||||
SystemRuntimeAssemblyReference,
|
||||
SecureStringAssemblyReference,
|
||||
ObjectImplementationAssemblyReference,
|
||||
MetadataReference.CreateFromFile(typeof(PSObject).GetTypeInfo().Assembly.Location)
|
||||
};
|
||||
|
||||
@@ -1233,10 +1231,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
if (referencedAssembliesSpecified)
|
||||
{
|
||||
var tempReferences = ReferencedAssemblies.Select(a => MetadataReference.CreateFromFile(ResolveReferencedAssembly(a))).ToList();
|
||||
foreach (var reference in autoReferencedAssemblies)
|
||||
{
|
||||
tempReferences.Add(reference);
|
||||
}
|
||||
tempReferences.AddRange(autoReferencedAssemblies);
|
||||
|
||||
references = tempReferences.ToArray();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user