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?

2
  • Is your PowerShell window being run as administrator? Looks like just a rights issue to me. Commented Feb 8, 2018 at 15:06
  • Well... there you go. Sigh. So obvious. Do you want to mark as an answer @MarkWragg Commented Feb 8, 2018 at 15:09

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.