我们正在运行一个 Team City 构建服务器,它已经在本地毫无问题地执行了这个脚本。但是,当我尝试手动运行此脚本时,我遇到了以下问题:
Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.
PowerShell Community Extensions Imported.
PS C:\Users\user.domain> cd D:\pkg\platform-2b0c7e3f71f9-BUILD01; powershell.exe -noprofile -executionpolicy Bypass -file D:\pkg\platform-2b0c7e3f71f9-BUILD01\stage.ps1 production \\192.168.x.x\staging \\testserver.domain.com\staging
D:\pkg\platform-2b0c7e3f71f9-BUILD01
Start Staging: 12/15/2014 11:18:14
Verifying target environment configuration and staging targets
Copying source and environment switch
...
Verifying configuration files are valid XML files
Test-Xml : The 'Test-Xml' command was found in the module 'Pscx', but the module could not be loaded. For more information, run 'Import-Module Pscx'.
At D:\pkg\platform-2b0c7e3f71f9-BUILD01\stage.ps1:72 char:9
+ if (!(Test-Xml $file))
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-Xml:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
所以我看到 PowerShell 社区扩展正在被导入(第 4 行),这让我想知道发生了什么。我正在以与在 Team City 下运行它的用户完全相同的用户身份运行该脚本。我检查了我试图复制的构建步骤:
而且我想不出我错过的任何东西(工作目录选项设置为脚本文件的目录)。任何想法,将不胜感激...