msbuild.exe a solution on the command line?

Sysprogs forums Forums VisualGDB msbuild.exe a solution on the command line?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #20636
    helpme
    Participant

    I’m using visualgdb and vagrant to build a linux project from visual studio.  All works fine through the Visual Studio IDE, but when calling msbuild on the command line it has issues finding vagrant.exe.  Vagrant.exe is in the PATH and in the Tools->Options->VisualGDB settings.  Does visualgdb support building the solution from the command line?

    Here is the error:

    “C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe” foo.sln /p:Configuration=Release /p:Platform=VisualGDB /m /l:FileLogger,Microsoft.Build.Engine;logfile=foo.txt

    3>CommitRemoteBuild:
    VisualGDB version 5.4.1.2126
    System.Reflection.TargetInvocationException
    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.Exception: Cannot find vagrant.exe in PATH directories. Please specify its path manually via Tools->Options->VisualGDB
    at pw1.e()
    at pw1.m(i b, rt a)
    at iw.y(String b, String a)
    at iw.b.i(String b, String a, g c)
    at iw.f(RemoteHostSettings a)
    at tu1.f(RemoteHostSettings b, Boolean a)
    at di1.o4(SourceTransferAction c, SourceCache a, mg b)
    at pn1.b_2(Boolean b, Boolean& a)
    at br.j(BuildMode a, g b)
    at br.e(BuildMode a)
    at w51.e(String b, BuildMode c, i a)
    at VisualGDB.MSBuild.BuildHelper.LaunchBuildAction(String action, String settingsFile, String generatedMakefile, String targetPath, String cancelEventName, IBuildCallbacks callbacks, Boolean suppressErrorParsing)
    at Sysprogs.build.tasks.shared.LaunchVisualGDB.<>c__DisplayClass21_0.<Execute>b__0()
    — End of inner exception stack trace —
    at Sysprogs.build.tasks.shared.LaunchVisualGDB.Execute()
    —Inner exception—
    System.Exception: Cannot find vagrant.exe in PATH directories. Please specify its path manually via Tools->Options->VisualGDB
    at pw1.e()
    at pw1.m(i b, rt a)
    at iw.y(String b, String a)
    at iw.b.i(String b, String a, g c)
    at iw.f(RemoteHostSettings a)
    at tu1.f(RemoteHostSettings b, Boolean a)
    at di1.o4(SourceTransferAction c, SourceCache a, mg b)
    at pn1.b_2(Boolean b, Boolean& a)
    at br.j(BuildMode a, g b)
    at br.e(BuildMode a)
    at w51.e(String b, BuildMode c, i a)
    at VisualGDB.MSBuild.BuildHelper.LaunchBuildAction(String action, String settingsFile, String generatedMakefile, String targetPath, String cancelEventName, IBuildCallbacks callbacks, Boolean suppressErrorParsing)
    at Sysprogs.build.tasks.shared.LaunchVisualGDB.<>c__DisplayClass21_0.<Execute>b__0()

    #20640
    support
    Keymaster

    Hi,

    As the environment variables like PATH are set per-process and are inherited from the parent process, sometimes some unexpected configuration settings interfere with them.

    Please double-check the PATH value from the same command-line prompt where you run MSBuild (also ensure it’s the same user account that runs VS, as the manual vagrant location is set per-user).

    #20650
    helpme
    Participant

    The PATH in the command prompt contains the vagrant.exe and it works, but when using msbuild, VisualGDB can’t find the vagrant.exe.  The user account is the same.

    Does msbuild work for you?  Even though msbuild fails, I was able to use devenv.com successfully in the same command prompt window.  Does VisualGDB require the Visual Studio IDE to load properly?

    This worked:

    “\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.com” foo.sln /rebuild “Release|VisualGDB” /Out foo.log

    #20661
    support
    Keymaster

    Hi,

    Yes, we have double-checked it with MSBuild and could not get any error (other than VirtualBox issues from trying to access an elevated instance from a non-elevated command prompt). Please try this build, it will list the exact PATH directories it checks and the explicit vagrant location from the settings: http://sysprogs.com/files/tmp/VisualGDB-5.4.1.2164.msi

    Please double-check the output for typos, extra spaces/quotation marks, UAC-related problems, etc.

    #20667
    helpme
    Participant

    It is odd that visualgdb works fine when using devenv.com, but fails with msbuild being unable to find vagrant.exe (both programs started from the same command prompt so the permissions are identical).

    What msbuild options did you use to get the build to succeed?

    Are you using VS2017?

    Here is the latest output:

    “C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe” foo.sln /p:Configuration=Release /p:Platform=VisualGDB /m /l:FileLogger,Microsoft.Build.Engine;logfile=C:\foo.txt /verbosity:d

    .

    .

    .

    Using “LaunchVisualGDB” task from assembly “C:\Program Files (x86)\Sysprogs\VisualGDB\Sysprogs.Build.Tasks.dll”.
    Task “LaunchVisualGDB”
    VisualGDB version 5.4.1.2164
    System.Reflection.TargetInvocationException
    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.Exception: Cannot find vagrant.exe in PATH directories. Please specify its path manually via Tools->Options->VisualGDB. Checked PATH: ; Explicit location: C:\HashiCorp\Vagrant\bin
    at uf1.h()
    at uf1.b(l a, o02 b)
    at xi2.h1(String b, String a)
    at xi2.e.i(String b, String a, g c)
    at xi2.e1(RemoteHostSettings a)
    at pc.d(RemoteHostSettings b, Boolean a)
    at g6.q4(SourceTransferAction a, SourceCache b, zd2 c)
    at hx1.a_2(Boolean a, Boolean& b)
    at ik.j(BuildMode b, f a)
    at ik.i(BuildMode a)
    at pr1.a(String c, BuildMode a, c b)
    at VisualGDB.MSBuild.BuildHelper.LaunchBuildAction(String action, String settingsFile, String generatedMakefile, String targetPath, String cancelEventName, IBuildCallbacks callbacks, Boolean suppressErrorParsing)
    at Sysprogs.build.tasks.shared.LaunchVisualGDB.<>c__DisplayClass21_0.<Execute>b__0()
    — End of inner exception stack trace —
    at Sysprogs.build.tasks.shared.LaunchVisualGDB.Execute()
    —Inner exception—
    System.Exception: Cannot find vagrant.exe in PATH directories. Please specify its path manually via Tools->Options->VisualGDB. Checked PATH: ; Explicit location: C:\HashiCorp\Vagrant\bin

     

     

    C:\> dir C:\HashiCorp\Vagrant\bin
    Directory of C:\HashiCorp\Vagrant\bin
    01/29/2018  08:05 PM         2,279,424 vagrant.exe

    #20672
    support
    Keymaster

    Hi,

    Thanks for sharing the error message. It looks like some MSBuild rules might be overriding the PATH variable (enabling verbose msbuild output might help diagnose it) and the explicit location is not working because it specifies the directory name, not the full path of vagrant.exe. You can simply change it to C:\HashiCorp\Vagrant\bin\vagrant.exe and it will work.

    #20687
    helpme
    Participant

    I previously tried to set the full path in Tools->Options->VisualGDB, but it didn’t work.  The key was to restart Visual Studio after changing the path.

    I’m using the default msbuild rules and property sheets, so nothing is overridden on purpose and other tools in the %PATH% work fine…just not VisualGDB trying to find vagrant.exe.  I have it working now by modifying the options, so thank you.

    #20688
    support
    Keymaster

    Hi,

    Good to know it works. It’s hard to say what part of the build process resets the PATH variable. It did not get reset in our test environment and it could be tricky to track it down, so if the manual location works, we would advise to keep using it.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.