2

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.

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

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.

I have read An exception occurred while invoking executor 'executor://mstestadapter/v1': Object reference not set to an instance of an object

Does any one know why this would be?

MyDaftQuestions
  • 4,487
  • 17
  • 63
  • 120

1 Answers1

1

The error occurs because you are not running the PowerShell console with administrator rights (right click PowerShell > Run as Administrator).

Mark Wragg
  • 22,105
  • 7
  • 39
  • 68