简体   繁体   English

无法从 Powershell 执行测试

[英]Can't execute test from Powershell

I'm having a play with Powershell and understanding how to control Visual Studio over the command line in a bid to try to understand the basics of the dev ops world.我正在玩 Powershell 并了解如何通过命令行控制 Visual Studio,以尝试了解开发运营世界的基础知识。

If I run this in the command line如果我在命令行中运行它

vstest.console "C:\Users\me\source\repos\Test03\UnitTestProject1\bin\Release\UnitTestProject1.dll"

It executes as desired.它按需要执行。

If I run the same script from Powershell I get如果我从 Powershell 运行相同的脚本,我会得到

Starting test execution, please wait...
vstest.console : An exception occurred while invoking executor 'executor://mstestadapter/v2': Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\TestResults\Deploy_Me 
2018-02-08 14_53_12' is denied.
At C:\Users\me\source\repos\Test03\autostageplan.ps1:12 char:1
+ vstest.console "C:\Users\me\source\repos\Test03\UnitTestProjec ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (An exception oc..._12' is denied.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

vstest.console has been set up as an environment variable if that has any impact.如果有任何影响,vstest.console 已设置为环境变量。

I have read An exception occurred while invoking executor 'executor://mstestadapter/v1': Object reference not set to an instance of an object我已阅读调用执行程序时发生异常 'executor://mstestadapter/v1': Object reference not set to an instance of an object

Does any one know why this would be?有谁知道为什么会这样?

发生错误是因为您没有以管理员权限运行 PowerShell 控制台(右键单击 PowerShell > 以管理员身份运行)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM