【问题标题】:Add-Type : (0) : Metadata file 'System.Linq.dll' could not be found添加类型:(0):找不到元数据文件“System.Linq.dll”
【发布时间】:2016-04-16 12:52:05
【问题描述】:

通过此处列出的自动化工作 - https://github.com/cloudbase/windows-openstack-imaging-tools 并查询 github,但认为这也是一个有用的查询站点。

这是错误引用的代码的 sn-p。我知道我没有包括整个脚本(即,我们没有关于 $code 是什么的信息),但是看看实际代码行中的任何内容是否可以改进或导致错误。谢谢!

代码:

if (-not ([System.Management.Automation.PSTypeName]'WIMInterop.WimFile').Type)
{
    Add-Type -TypeDefinition $code -ReferencedAssemblies "System.Xml","System.Linq","System.Xml.Linq"
}

错误:

Add-Type : (0) : Metadata file 'System.Linq.dll' could not be found
(1) : /*
At C:\windows-openstack-imaging-tools-master\Interop.ps1:1353 char:13
+     Add-Type <<<<  -TypeDefinition $code -ReferencedAssemblies "System.Xml","System.Linq","
    + CategoryInfo          : InvalidData: (error CS0006: M...ld not be found:CompilerError)
    + FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand

【问题讨论】:

    标签: powershell windows-7 openstack


    【解决方案1】:

    System.Linq 命名空间未包含在专用程序集中。

    大多数类(例如Enumerable)都在System.Core.dll 中,因此请参考System.Core 程序集

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-10-20
      • 2010-11-28
      • 2015-05-13
      • 2018-10-05
      • 1970-01-01
      • 2011-05-18
      相关资源
      最近更新 更多