|
referencing system.management.automation DLL (or other Gac'd ones) How do you reference DLLs in the gac dynamically? Is there a method to
find a link to the gac'd items? Currently the only way I can seem to
reference this one dynamically to pass to CSharpCodeProvider is by
looking at the location of the currently loaded one with
$(([appdomain]::currentdomain.getassemblies() |where {($_.fullname
-match "system.management.automation")}).location)
$ClassSystem.CSharpCodeProvider = new-object
Microsoft.CSharp.CSharpCodeProvider
$ClassSystem.StandardParams = new-object
System.CodeDom.Compiler.CompilerParameters
$ClassSystem.StandardParams.GenerateInMemory = $True
$private:refs = "System.DLL","System.management.dll",
$(([appdomain]::currentdomain.getassemblies() |where {($_.fullname
-match "system.management.automation")}).location)
$ClassSystem.StandardParams.ReferencedAssemblies.AddRange($refs)
-Karl |