Sysprogs forums › Forums › VisualGDB › "Before building" custom step missing "PATH" env variable
Tagged: CustomStep PATH
- This topic has 6 replies, 2 voices, and was last updated 4 years, 7 months ago by
wtywtykk.
-
AuthorPosts
-
April 4, 2021 at 00:02 #30300
wtywtykk
ParticipantI’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.
April 4, 2021 at 08:01 #30301support
KeymasterHi,
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.
April 4, 2021 at 09:36 #30302wtywtykk
ParticipantHi,
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.
April 4, 2021 at 09:43 #30303support
KeymasterHi,
No problem, you can set the CommonExecutablePath property by manually adding the following lines to the .vcxproj file:
<PropertyGroup> <CommonExecutablePath>[Value]</CommonExecutablePath> </PropertyGroup>April 4, 2021 at 11:15 #30304wtywtykk
ParticipantHi,
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.
April 6, 2021 at 12:00 #30313support
KeymasterHi,
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
April 8, 2021 at 19:23 #30321wtywtykk
ParticipantGreat! It works!
-
AuthorPosts
- You must be logged in to reply to this topic.