Search code examples
c#powershellyamlmstestgitlab-ci

gitlab ci yml error on passing file path to powershell


Trying to invoke mstest.exe through powershell in gitlab ci yml. When I give the path as C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\mstest.exe powershell gives me an error saying C:\program no such cmdlet function exists.

When I give the path in quotes I get an invalid yml error:

This GitLab CI configuration is invalid: (<unknown>): found unknown escape character while parsing a quoted scalar at line 26 column 17
test_job:
  stage: test
  variables:
    MSTestPath: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\mstest.exe"
    TestContainer: "/testcontainer: +$ProjectDLL"
    TestName: "/test:+$TestName"
    TestSettings: "/testsettings: +$TestSettingsPath"
  script:
    - echo "testing..."
    - powershell '&' $MSTestPatch  $TestContainer $TestName $TestSettings
  only:
    - master
  tags:
    - migration

I want to execute my mstests using gitlab CI in my runner(which is my windows machine) using powershell as the shell.


Solution

  • You can use \"C:\Program Files (x86)\Microsoft Visual Studio 14.0\"