Author Topic: Is it possible to set command line options for msbuild?  (Read 377 times)

macjohnmcc

  • Community Member
  • Posts: 53
  • Hero Points: 0
Is it possible to set command line options for msbuild?
« on: August 14, 2019, 08:55:00 pm »
I need to add a command line option to visual studio .net builds to set an option.

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1275
  • Hero Points: 126
Re: Is it possible to set command line options for msbuild?
« Reply #1 on: August 15, 2019, 10:54:45 am »
Do you need to add an option to the build command used by SlickEdit for builds or need to edit an option that is property in the Visual Studio project?  The build commands are listed under Project Properties, Tools tab where each command is located.   If you need to change any compiler or linking option for the project itself, that needs to be done with Visual Studio.

macjohnmcc

  • Community Member
  • Posts: 53
  • Hero Points: 0
Re: Is it possible to set command line options for msbuild?
« Reply #2 on: August 15, 2019, 03:14:09 pm »
Due to the way that the build environment is setup on my projects I need to tell MSBuild to use the environment variables for include, lib, path to the compiler etc rather than determining these things itself.

I need to specify this for the builds
/property:VCBuildUseEnvironment=true

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1275
  • Hero Points: 126
Re: Is it possible to set command line options for msbuild?
« Reply #3 on: August 15, 2019, 03:37:37 pm »
Depending on how the project was created, it may already be setup to use MSBuild for command line builds, you can modify or add parameters to the command-line using Project Properties, Tools tab and change Build, Rebuild or whatever build tool needs to be changed.

macjohnmcc

  • Community Member
  • Posts: 53
  • Hero Points: 0
Re: Is it possible to set command line options for msbuild?
« Reply #4 on: August 15, 2019, 03:53:39 pm »
The project is a visual studio vcxproj file that typically we build with devenv.exe /useenv <parameters>

It appears to build this same project file vs uses msbuild and the only thing stopping this from working for me is the ability to specify parameters for msbuild in addition to whatever you are already specifying.

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1275
  • Hero Points: 126
Re: Is it possible to set command line options for msbuild?
« Reply #5 on: August 15, 2019, 04:08:01 pm »
You can replace the existing devenv command-line to use msbuild instead.  We use msbuild as the default build command for newer releases of Visual Studio anyway with the newer templates.  The default command-line now looks like:
msbuild "%w" /t:"%sf" /p:Configuration="%bn" /p:Platform="%bp" /nologo /v:m

where %w gets translated to workspace, %sf is the source project target and others are pretty self-explanatory.  You can use that to start, and then append whatever additional property arguments to that.

macjohnmcc

  • Community Member
  • Posts: 53
  • Hero Points: 0
Re: Is it possible to set command line options for msbuild?
« Reply #6 on: August 15, 2019, 04:14:34 pm »
I was just hoping I could ride along and just have additional command line options to add to your existing. Thank you.

macjohnmcc

  • Community Member
  • Posts: 53
  • Hero Points: 0
Re: Is it possible to set command line options for msbuild?
« Reply #7 on: August 15, 2019, 06:10:03 pm »
I changed the commands for the project properties for build and rebuild is to just run nmake. What I see when I compile though is that it is running vsbuild.

I have attached a screenshot of the "Build" settings for the project.

c:\vs2019\win\vsbuild build -b C:\dev\Entrap\EntrapHK\HKCallbacks.cpp -beep -c Debug|x64 C:\dev\Entrap\EntrapHK\EntrapHK.sln C:\dev\Entrap\EntrapHK\EntrapHK.vpj -signal 51106
'x64' is not recognized as an internal or external command,
operable program or batch file.

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1275
  • Hero Points: 126
Re: Is it possible to set command line options for msbuild?
« Reply #8 on: August 15, 2019, 06:57:05 pm »
Is that the output running the Compile or Build tool from the menu?  Are there multiple projects/dependencies involved in the same solution file that it is trying to build?  I would have to look at your SlickEdit .vpj/.vpw file to see how those commands are configured to see what is going on?  Could also be the Beep on completion option causing something weird in this case, I will have to double-check that option to see if there is some issue building the command-line.

UPDATE: Yep, the addition of the Beep on completion option is mangling the command-line, that is causing an issue.  That option may need to be disabled for this case, but I will check into it see what needs to be fixed.

UPDATE[2]: This will be fixed in next beta release. Thanks for the report.
« Last Edit: August 15, 2019, 07:29:15 pm by Lee »

macjohnmcc

  • Community Member
  • Posts: 53
  • Hero Points: 0
Re: Is it possible to set command line options for msbuild?
« Reply #9 on: August 15, 2019, 09:08:42 pm »
You managed to make me obsolete in solving this. Thanks!
One big win for VS today was that I was trying to rename a variable in a C++ project and neither Visual AssistX plugin nor Resharper C++ pluging could successfully rename it across all the files. VS 2019 Beta 2 did rename properly.