Whats the best way to wrap a c# class for use by powershell script -
I have an engine that executes the powerhouse script, and when they execute, the caller feeds back into some XML Need to do The engine only takes I / O as an IWF xml message, so the script has to return the same formatted XML message. I have a class that makes my formatting for me and this script writers want to use it.
So the question is, I want to make the AC # class able to use by parsarer.
I saw something like that where you can refer to the C # class using class bracket crowd, e.g.
How can you make C # available for use in this way? I think that it should be made in class Lib and is being loaded in some way PowerShell Runtime but how. Apart from this, like how I am running a Parschend from C #, how do I add it to the environment at that time?
Any help would be appreciated. Bob
PowerShell can load it if it has an assembly (exe or dll) with the class [System.Reflection.Assembly] :: LoadFile ("PathToYourAssembly") via
or in V2
Add-Type -Path "PathToYourAasembly"
If you are making a runspace in your application and want to make an assembly available, you can do it together.
Runpace configuration rsConfig = Runspaceconfiguration.Create (); Assembly configuration = enter my assembly = new assemblyEnterree ("strong name for my assembly", "alternative path for my assembly"); RsConfig.Assemblies.Append (myAssembly); Runpace myRunSpace = Ranspacefactine Creatorpress (rsconfig); MyRunSpace.Open ();
Comments
Post a Comment