【发布时间】:2014-12-16 01:23:00
【问题描述】:
我们正在运行一个 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 下运行它的用户完全相同的用户身份运行该脚本。我检查了我要复制的构建步骤:
我想不出我错过了什么(工作目录选项设置为脚本文件的目录)。任何想法将不胜感激...
【问题讨论】:
标签: powershell teamcity pscx