"Before building" custom step missing "PATH" env variable

Sysprogs forums Forums VisualGDB "Before building" custom step missing "PATH" env variable

This topic contains 6 replies, has 2 voices, and was last updated by  wtywtykk 1 week, 3 days ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #30300

    wtywtykk
    Participant

    I’m using a custom program to perpare a configuration file for my project. The program uses git command to get current branch name. However it can’t find git command because PATH env variable is missing.

    I searched in this forum and found a similar problem: https://sysprogs.com/w/forums/topic/before-building-custom-step-path-missing/

    Using the notepad way I found something related: If I run devenv with /UseEnv commandline, the PATH is back. Though I still can’t find the path settings described by microsoft. (https://docs.microsoft.com/en-us/visualstudio/ide/reference/useenv-devenv-exe?view=vs-2019)

    In the targets files, the env variable seems to be set by target “SetBuildDefaultEnvironmentVariables” from “$(ExecutablePath)”. Is it possible the problem is caused by an empty ExecutablePath? If so, could you fix this?

     

    PS: sometimes the PATH is back even without /UseEnv but it will disappear after closing all VS sessions.

    #30301

    support
    Keymaster

    Hi,

    It’s hard to suggest something specific here because the variable logic is handled by the Visual Studio itself rather than VisualGDB. You can try reproducing the problem on a regular non-VisualGDB project using the Exec task and then contact Microsoft for help.

    If the VisualGDB projects behave differently from the regular MSBuild projects, please let us know and we will help you replicate the regular VC++ behavior.

    #30302

    wtywtykk
    Participant

    Hi,

    By clearing the VC++ Directories -> Executable Directories in regular VC projects, the problem can be reproduced.

    And the description for Executable Directories:

    Executable Directories
    Directories in which to search for executable files. Corresponds to the PATH environment variable.

    So I believe the problem is VisualGDB setting this property blank. Setting this to $(CommonExecutablePath) would solve the problem.

    #30303

    support
    Keymaster

    Hi,

    No problem, you can set the CommonExecutablePath property by manually adding the following lines to the .vcxproj file:

    #30304

    wtywtykk
    Participant

    Hi,

    I added

    <PropertyGroup>
    <ExecutablePath>$(CommonExecutablePath)</ExecutablePath>
    </PropertyGroup>

    to my vcxproj and it works. And would you add this by default in later updates? Not having PATH in custom steps is just surprising.

    #30313

    support
    Keymaster

    Hi,

    No problem. We have rechecked the handling of CommonExecutablePath and ExecutablePath by the regular VC++ projects and updated VisualGDB to replicate its behavior.

    Please try this build: VisualGDB-5.6.1.4083.msi

    #30321

    wtywtykk
    Participant

    Great! It works!

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.