ilammy/msvc-dev-cmd

VisualStudioVersion is not set

Closed this issue · 6 comments

First off -- thanks for the hard work and contribution!

I'm working on a custom pipeline -- the build step of my project uses a tool which must be run in the context of a VS dev prompt and relies on the variable VisualStudioVersion.

Here's a stripped down version of my pipeline:

jobs:
  build:
    runs-on: windows-latest
    steps:
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    - uses: actions/checkout@v2
    - uses: ilammy/msvc-dev-cmd@v1.0.1
    - name: Build ament source
      run: colcon build --merge-install --cmake-args -A x64
      working-directory: ./dev/ament
      shell: cmd

The colcon build command reports VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.

I'm really new to GitHub actions so this very well could be user error. I've read some things about needing to explicity export environment variables to pipelines or does your extension take care of this?

I see now that this is likely just a matter of adding VisualStudioVersion to this list:

const InterestingVariables = [

I'll see if I can fork and test it out myself. If successful, I'll submit a PR..

It worked! Thanks very much for the help -- your advice to run npm install and check in the node_modules directory for local testing saved me hours of googling.

Change worked and lets my tool run properly -- PR submitted.

Hey @ilammy -- FYI I have discovered that I don't actually need your action at all. Since my project is a C++/cmake project, it doesn't need to run in an actual VS Dev command prompt.

I don't quite understand why the build tool (I did not write it) requires that variable, but it is working fine for me to just set that variable in my actions workflow to 'fake' the tool.

So, the PR still stands related to this issue, but I don't technically need it anymore. I'll leave it up to you to determine if it's good to have or not :)

Thanks again for the help

I’ve pushed v1.1.0 which contains this fix.

Any of the following specs will pull the updated version:

- uses: ilammy/msvc-dev-cmd@v1.1.0
- uses: ilammy/msvc-dev-cmd@v1       # preferred