1

I read the suggestions on How to load assemblies in PowerShell?, but I didn't really understand it and I don't know how to apply it to my situation.

I'm trying to load this assembly http://msdn.microsoft.com/en-us/library/system.runtime.serialization.formatters.binary.binaryformatter.aspx so that I can serialize an object, and being very new to powershell I feel like I'm in over my head.

Can anyone guide me to how I go about loading this assembly into a script? I'm getting the error:

make sure that the assembly containing this type is loaded

And when I use Add-Type -Namespace System.Runtime.Serialization.Formatters.Binary it prompts me for information for which I don't know how to provide.

4

1 回答 1

2

BinaryFormatter存在并且mscorlib.dll已经加载。要创建新对象,您可以执行以下操作:

$formatter = new-object System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
于 2013-09-12T12:22:28.003 回答