Author Topic: How does slick edit pick which version of msbuild to execute?  (Read 1703 times)

paulae

  • Community Member
  • Posts: 17
  • Hero Points: 0
I'm using slick edit 26.0.1.0 64 bit under windows 11. I have multiple versions of Visual studio installed. Slick edit appears to always pick the oldest installed version when I build projects. So if I have 2017, 2019, and 2022 installed - I get msbuild for VC 2017. If I have 2019 and 2022 installed, I get msbuild for 2019. The project I'm using was created under VS2022, and the older versions of msbuild don't work because WSL support in MSVC prior to 2022 was somewhat lacking. The only way I've found to consistently get the VS2022 version of msbuild to execute when I build the project in slickedit is to setup the VS2022 environment from a command prompt and then execute slick edit from that command prompt. This is really irritating.

Changing the compiler settings in slick edit appear to make *no* difference in this.

BTW, it works fine if I only have VS 2022 installed. Unfortunately, I have to switch between VS 2017, 2019, and 2022, so I don't have that option.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6990
  • Hero Points: 533
Re: How does slick edit pick which version of msbuild to execute?
« Reply #1 on: April 01, 2022, 07:52:26 PM »
Start a visual studio command prompt where the environment is already set. Each installation of Visual Studio will have several accessible command prompts from the Windows Start menu. Then start SlickEdit from that command prompt. I have VS2022, VS2019, and VS2017 installed and this works well.  I keep each of the Visual Studio version command prompts pinned to my task bar. SlickEdit also has a macro variable to force a particular version to be chosen but this is a little less convenient because there is no GUI for it.

paulae

  • Community Member
  • Posts: 17
  • Hero Points: 0
Re: How does slick edit pick which version of msbuild to execute?
« Reply #2 on: April 04, 2022, 05:41:30 PM »
Yes, this is what I've figured out to do. It's inconvenient because I'll have 3-4 SE editors open with different msbuild settings, so I have to make sure that if i open a project, it is in the SE instance that uses the correct msbuild environment. Creating a shortcut to call vsvars64 of the right version to do this is annoying because it leaves a small dos shell instance open on the tool bar. That may not sound bad, and it isn't the end of the world, but I have a BUNCH of command windows open too, so it's confusing. I'll write something to handle this (set the environment, spawn SE, and then terminate), I guess, but it's a small quality of life issue. It would be nice to associate the msbuild environment with the project, so that when I open the project, it chooses the correct toolset. This is mostly a minor annoyance except for WSL2 projects, where VS2022's build environment is much, much more pleasant for WSL builds. (VS2019 requires some mildly annoying setup per machine to work in WSL, while VS2022 just works when I move the project between machines.)

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6990
  • Hero Points: 533
Re: How does slick edit pick which version of msbuild to execute?
« Reply #3 on: April 04, 2022, 10:19:24 PM »
Too bad there isn't something easy for SlickEdit to check in your Visual Studio solution file that tells SlickEdit the version you want to use. SlickEdit used to lean toward some version info in the .sln file but then this blew up in our faces.  Putting something in the .vpw or .vpj file could work but you are supposed to be able to delete these files so they can be recreated the next time you open the .sln file. We will have to figure out where this setting can go.