Visual studio 2010 Powershell命令站构建VS2010

Visual studio 2010 Powershell命令站构建VS2010,visual-studio-2010,powershell,Visual Studio 2010,Powershell,我在VisualStudio2010的生成后事件命令行中有一个命令 Powershell-command.'$(SolutionDir)Powershell\MoveFiles.ps1' 当事件运行时,我得到一个错误,命令“以代码1退出” 但是,当我在命令行上运行相同的命令(见下文)时,使用实际目录而不是VS2010宏,它工作得非常好 Powershell-command.C:\TFS\MyProject\Main\Source\Powershell\MoveFiles.ps1' 因此,问题似乎

我在VisualStudio2010的生成后事件命令行中有一个命令

Powershell-command.'$(SolutionDir)Powershell\MoveFiles.ps1'

当事件运行时,我得到一个错误,命令“以代码1退出”

但是,当我在命令行上运行相同的命令(见下文)时,使用实际目录而不是VS2010宏,它工作得非常好

Powershell-command.C:\TFS\MyProject\Main\Source\Powershell\MoveFiles.ps1'

因此,问题似乎在于VS2010如何执行该命令

是什么导致了这个问题

[更新]

我还尝试将生成后事件更改为:


C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Powershell-command.C:\TFS\MyProject\Main\Source\Powershell\MoveFiles.ps1'
我得到了与上述相同的结果。当从命令行运行时,它可以工作,但不能从VS 2010运行。

如果在64位操作系统上运行,则需要指定64位版本powershell的完整路径,因为Visual Studio是32位应用程序

有一个答案可以解决这个问题。

有两件事:

  • 使用
    -file
    参数代替
    -command
    参数
  • 使用双引号

  • powershell.exe-file“$(SolutionDir)powershell\MoveFiles.ps1”

    相同的结果:工作正常,或者给您一个错误?@Zespri-thx。修复了Visual Studio生成中的post.In并获取错误。然后从顶部菜单中选择“查看”并选择“输出”。输出窗口将出现。检查窗口中的内容,如果原因仍然不清楚,请在此处发布输出。干杯