【问题标题】:Issue while building Windows Azure PowerShell CmdLet for Node.js/PHP为 Node.js/PHP 构建 Windows Azure PowerShell CmdLet 时出现问题
【发布时间】:2012-07-07 13:55:22
【问题描述】:

我正在尝试构建 Windows Azure PowerShell cmdlet,但在加载 cmdlet 时遇到问题。我已按照以下步骤操作:

  1. 从主分支https://github.com/WindowsAzure/azure-sdk-tools克隆了最新的代码
  2. 使用 VS 2010 SP1 Ultimate 构建解决方案 WindowsAzurePowershell.sln [我安装了用于 Windows Azure 和 WIX 的 Windows Azure SDK 1.7、VS 2010 工具]
  3. 构建解决方案后,打开文件夹 C:\repo\Windows-Azure-SDK-Nodejs-Git\azure-sdk-tools\Package\Debug 并尝试通过运行以下命令加载 cmdlet: 获取-ChildItem '.*.psd1' | ForEach-Object {Import-Module $_}

并得到以下错误。有人可以帮我解决这个问题吗?

如果我使用 WebPI 安装官方 cmdlet 位,则一切正常。但是使用我构建的 msi 安装的 cmdlet 加载失败,出现同样的错误。

错误:

PS C:\repo\Windows-Azure-SDK-Nodejs-Git\azure-sdk-tools\Package\Debug> Get-ChildItem '.*.psd1' | ForEach-对象 {Import-Module $} > error.txt 导入模块:无法加载 Windows PowerShell 管理单元 C:\Interop-TFS\Windows-Azure-SDK-Nodejs-Git\azure-sdk-tools\Pack age\Debug\Microsoft.WindowsAzure.Management.ServiceManagement.dll 因为以下错误:无法加载一个或 更多请求的类型。检索 LoaderExceptions 属性以获取更多信息。 加载程序例外: 无法加载文件或程序集“Microsoft.WindowsAzure.Management,版本=1.0.0.0,文化=中性,PublicKeyToken=31 bf3856ad364e35' 或其依赖项之一。该系统找不到指定的文件。 无法加载文件或程序集“Microsoft.WindowsAzure.Management,版本=1.0.0.0,文化=中性,PublicKeyToken=31 bf3856ad364e35' 或其依赖项之一。该系统找不到指定的文件。 无法加载文件或程序集“Microsoft.WindowsAzure.Management,版本=1.0.0.0,文化=中性,PublicKeyToken=31 bf3856ad364e35' 或其依赖项之一。该系统找不到指定的文件。 无法加载文件或程序集“Microsoft.WindowsAzure.Management,版本=1.0.0.0,文化=中性,PublicKeyToken=31 ...... bf3856ad364e35' 或其依赖项之一。该系统找不到指定的文件。 无法加载文件或程序集“Microsoft.WindowsAzure.Management,版本=1.0.0.0,文化=中性,PublicKeyToken=31 bf3856ad364e35' 或其依赖项之一。该系统找不到指定的文件。 在行:1 字符:57 + Get-ChildItem '.*.psd1' | ForEach-Object {Import-Module } > error.txt + CategoryInfo : ResourceUnavailable: (:) [Import-Module], PSSnapInException + FullyQualifiedErrorId : PSSnapInLoadFailure,Microsoft.PowerShell.Commands.ImportModuleCommand

【问题讨论】:

    标签: powershell azure


    【解决方案1】:

    试试这个:

    • 转到控制面板和所有与“Windows Azure Powershell *”相关的东西,全部卸载。
    • 现在安装Windows Azure Powershell CMdlets
    • 验证您是否安装了 powershell @C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell(您将在此文件夹中的所有 dll 导致您的问题案例中丢失)
    • 现在以管理员模式打开 Windows Powershell 提示符
    • 使用此link 并按照流程验证您是否可以访问 Windows Azure 管理服务(这只是为了验证您的计算机中是否拥有所需的所有模块)
    • 现在尝试任何你想尝试的东西,应该不会有任何问题。

    【讨论】:

    • 谢谢阿夫卡什。我解决了这个问题,项目中的引用(主分支和开发分支)都指向签名的 DLL。我在开发机器中禁用了强名称验证,现在我可以加载模块和调试了。
    • 很高兴您的问题得到解决。祝你接下来的问题好运。
    • 谢谢阿夫卡什。原因是我想调试和理解代码流,试图理解实现:)
    • @Anu Thomas Chandy,我有同样的问题,试图导入定制的 PowerShell 模块。请问,您能分享一下您是如何解决问题的吗?
    猜你喜欢
    • 2011-03-20
    • 1970-01-01
    • 1970-01-01
    • 2021-07-25
    • 2011-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多