[英]HttpClient concurrent behavior different when running in Powershell than in Visual Studio
[英]Powershell SnapIn when running in Visual Studio publish
在Visual Studio中为我的项目进行文件系统发布时,我正在尝试运行Powershell脚本,但是在实际运行发布时,管理单元似乎不起作用。
如果我在Visual Studio外部手动运行Powershell脚本,则该管理单元可以正常工作,但是当通过发布执行该管理单元时,它将无法正常工作。
这是.pubxml配置文件中的目标。
<Target Name="Test" AfterTargets="GatherAllFilesToPublish">
<Message Text="********************************** Test ***********************************" Importance="high" />
<Exec Command="powershell.exe -file "$(ProjectDir)\Properties\PublishProfiles\test.ps1" $(ProjectDir)"/>
</Target>
这是PowerShell脚本
Add-PSSnapin Microsoft.TeamFoundation.PowerShell
$changeset = Get-TfsItemHistory $filePath -Recurse -StopAfter 1 | Select -ExpandProperty ChangesetId
导致
Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.TeamFoundation.PowerShell' is not installed on this computer.
如果Get-TfsItemHistory
命令存在替代方法,我还可以不使用管理单元。
我自己没有这个管理单元的个人经验,但是至少有一些想法:
Add-PSSnapin
,看看是否可以重现该错误 Get-PSSnapin
,检查可用的管理单元。 它很可能不存在,但是您可以使用installutil.exe
命令添加它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.