question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VisualStudioVersion is not set

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ilammycommented, Mar 19, 2020

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.

Maybe the tool’s authors thought that since you’re building for Windows, all this stuff will be already set and they can piggyback on these variables. It also may be that they look only at VisualStudioVersion and then infer other settings based on that.

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 😃

I’ll merge it anyway since maybe it will be useful to someone else too.

Nevertheless, I’m happy that your issue got resolved one way or another. And that you’ve got some experience with GitHub Actions 😉

Thanks for the contribution!

0reactions
ilammycommented, Mar 19, 2020

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
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ros2 windows10 colcon build fails on ros2_example_ws ...
... 'VisualStudioVersion is not set, ' RuntimeError: VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.
Read more >
ros2 can not build on visual studio 2019
I tried to use visual studio 2019 to build ros2 source code and it shows up the following errors by typing. colcon build...
Read more >
Detect Visual Studio version from within MSBuild project
On 2008, VisualStudioVersion is NOT set. On 2010 (and up presumably) it is. Created a project in VS2008 with the following added after...
Read more >
Default value of VisualStudioVersion - MSDN - Microsoft
I am trying to understand how default value of VisualStudioVersion is set. ... To clarify, I am building from command line, not from...
Read more >
Visual Studio: environment variables
Although in Visual Studio 2017, vsvars32.bat is not under … ... Up to Visual Studio version 2015 (?), the installer set the environment...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found