Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将程序集[Systems.Collections.Specialized.StringCollection]加载到Powershell中_Powershell_.net Assembly_Stringcollection - Fatal编程技术网

如何将程序集[Systems.Collections.Specialized.StringCollection]加载到Powershell中

如何将程序集[Systems.Collections.Specialized.StringCollection]加载到Powershell中,powershell,.net-assembly,stringcollection,Powershell,.net Assembly,Stringcollection,我半了解我的要求,并尽可能地对此进行研究 我正在尝试使用[Systems.Collections.Specialized.StringCollection]类型的对象: $newDBFiles = new-object Systems.Collections.Specialized.StringCollection; 我得到一个错误: 新对象:找不到类型[Systems.Collections.Specialized.StringCollection]:请确保已加载包含此类型的程序集。 第1行

我半了解我的要求,并尽可能地对此进行研究

我正在尝试使用[Systems.Collections.Specialized.StringCollection]类型的对象:

$newDBFiles = new-object Systems.Collections.Specialized.StringCollection;
我得到一个错误:

新对象:找不到类型[Systems.Collections.Specialized.StringCollection]:请确保已加载包含此类型的程序集。
第1行字符:15
+$newDBFiles=新对象Systems.Collections.Specialized.StringCollection;
+               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+CategoryInfo:InvalidType:(:)[New Object],pArgumentException
+FullyQualifiedErrorId:TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
我尝试了几种不同的方式加载程序集,但没有成功:

[System.Reflection.Assembly]::LoadWithPartialName(“System.Collections.Specialized”)| Out Null;
添加类型-程序集名称系统;
添加类型-AssemblyName systems.collections;
文档中说,
addtype
将接受.dll的一个位置。查看我想要的.dll的文档是
System.dll
。听起来它应该已经出现在我的系统上了

当我查看已加载的程序集时,我看到这一个,在我看来是正确的:

[appdomain]::currentdomain.getassemblies() | sort -property fullname | format-table fullname

System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a   

有很多关于使用该类型的帖子,但我找不到任何关于如何加载特定程序集的帖子。我需要一个特殊的.dll文件吗

扩展@PetSerAl的评论:在
系统
之后有一个s,不应该在那里。改为这样做

$newDBFiles = new-object System.Collections.Specialized.StringCollection;

System.Collections.Specialized.StringCollection
Argh。非常感谢你。对不起,耽误了你的时间。