Author Topic: Incorrect Visual Studio Version  (Read 193 times)

abushne

  • Community Member
  • Posts: 18
  • Hero Points: 0
Incorrect Visual Studio Version
« on: October 06, 2020, 03:26:57 pm »
We have a solution that we have setup to build using Visual Studio 2019.  However, when I try to load this solution file into SLickedit as a workspace to build etc.. SlickEdit treats it as if it is a Visual Studio 2017 solution and thus builds etc. fail, here is what I see in the "Build" tab for output when I load the sln as a workspace:
D:\>
D:\>set INCLUDE=
D:\>set LIB=
D:\>set VISUALSTUDIOVERSION=15.0

as you can see, the wrong setting..

I have tried a small solution created from scratch in Visual Studio 2019 and that works fine I have also opened the sln and the top of ours has the following version strings, which seem correct:


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29519.87
MinimumVisualStudioVersion = 10.0.40219.1

Any ideas what is going on?

I do have both Visual Studio 2017 AND Visual Studio 2019 on this system, but as noted, a simple console solution does set the correct build parameters...

abushne

  • Community Member
  • Posts: 18
  • Hero Points: 0
Re: Incorrect Visual Studio Version
« Reply #1 on: October 06, 2020, 06:54:09 pm »
I have managed to figure out what is going on. I have attached zip file containing  Visual Studio Solution and related project files all generated using Visual Studio 2019..  The issue occurs when you have CSharp projects in the solution. I am finding that the presence of the csproj overrides the solution in terms of what "Visual Studio" is being set / used. So on my machine, if I open the solution contained in the attached zip file, as a work space in SlickEdit, I see that the visual studio version/environment in SlickEdit is set to Visual Studio 15/2017..   If I remove the CSProject then reopen the sln as a workspace in slickedit, it properly sets things to be Visual Studio 16/2019... 

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5549
  • Hero Points: 449
Re: Incorrect Visual Studio Version
« Reply #2 on: October 06, 2020, 08:20:42 pm »
As a work around, set the macro variable def_use_visual_studio_version to 16  (Macro>Set Macro Variable...).

We will look into this to see if we can automate this any better.

abushne

  • Community Member
  • Posts: 18
  • Hero Points: 0
Re: Incorrect Visual Studio Version
« Reply #3 on: October 06, 2020, 08:27:25 pm »
OK, thank you.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5549
  • Hero Points: 449
Re: Incorrect Visual Studio Version
« Reply #4 on: October 06, 2020, 09:51:42 pm »
SlickEdit defaults to trying to figure out which version of Visual Studio you are using based on your def_auto_visual_studio_select macro variable setting. It looks like this:

Code: [Select]
projects,latest,solution,prompt

That means, SlickEdit checks your projects first, the solution version second, the latest installed version, and if all fails it prompts. You can change this order but it won't help the problem you are having.

Sounds pretty complete right? SlickEdit often can't figure out the version correctly from your projects or your solution. In your case, SlickEdit thought it figured out the version from the ToolsVersion=15.0 attribute in your csproj file. In your case, using the latest version seems like a better choice. However, I found a bug. 2019 doesn't seem to get recognized as the latest version even when it is the latest version. I'll add a hot fix for this.

The best solution is to set what you want with def_use_visual_studio_version. Always choosing the latest version has problems. Sometimes users install the latest Visual Studio to check it out but not for building.

The solution file (.sln) is notorious for being woefully out-of-date. Visual Studio does not update the version automatically.




abushne

  • Community Member
  • Posts: 18
  • Hero Points: 0
Re: Incorrect Visual Studio Version
« Reply #5 on: October 07, 2020, 10:05:28 am »
Thank you for the information it is very helpful.     Can this version setting be per workspace?

I wonder if you could also help solve this in the UI as follows:

  • Add a UI option to the "Visual Studio .NET solution" open dialog box that allows you to chose the studio version.
  • Store the choice in the VPW somehow
  • Add an option to later on "retarget" the VPW (similar to in Visual Studio I can retarget my toolset..

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5549
  • Hero Points: 449
Re: Incorrect Visual Studio Version
« Reply #6 on: October 07, 2020, 12:14:42 pm »
A per workspace setting would be useful as well as UI settings. If you need per a workspace setting now, just start SlickEdit from a pre-configured Visual Studio command prompt. When SlickEdit sees devenv in the PATH, SlickEdit simply uses the settings already configured.