Results 1 to 11 of 11

Thread: How does Visual Studio Selector Choose the version of Visual Studio to open a Project

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2020
    Posts
    59

    How does Visual Studio Selector Choose the version of Visual Studio to open a Project

    I read that the Visual Studio Selector chooses the version of Visual Studio based on the # Visual Studio Version specified in the .sln file. For example, # Visual Studio Version 17 refers to Visual Studio 2022, which controls the version number in the solution icon and indicates the version that most recently saved the file.

    https://learn.microsoft.com/en-us/vi...e?view=vs-2022

    If the specified version (e.g., # Visual Studio Version 17) is not installed on my PC, but I have both higher and lower versions of Visual Studio installed, how does the Visual Studio Selector decide which version to use? Will it always choose the higher version, or is there some other logic involved?

    Scenario:
    I have a project solution File that contains VS 2010 in solution file i.e. # Visual Studio Version 10, But I have Visual basic 2010, VS 2012 , VS 2017 Express Edition installed in my PC. My Visual Studio version selector chose VS 2012 IDE version to open this project, Why? What is the reason behind it ?
    Last edited by IT_Researcher; Jan 9th, 2025 at 03:04 AM.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,750

    Re: How does Visual Studio Selector Choose the version of Visual Studio to open a Pro

    I don't think I understand the question correctly. If you open a solution in VS2022, then VS2022 is the version of VS used to open the solution. If the sln file indicates some earlier version, VS2022 doesn't magically become that earlier version, it's still VS2022.

    In older versions, back around 2010 and earlier, each time you opened a solution in a newer version of VS, there was an upgrade process that changed some of the files. This could easily mean that once opened in a newer version of VS, you could no longer open the solution in an older version of VS. Somewhere after 2010, that behavior changed such that opening a solution created in an earlier version of VS didn't change the solution such that you could no longer use that earlier version of VS. The newer version didn't change the solution in such a way that older versions were precluded, but the changes that were being made earlier didn't seem all that significant (unless you changed the targeted framework).
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2020
    Posts
    59

    Re: How does Visual Studio Selector Choose the version of Visual Studio to open a Pro

    Quote Originally Posted by Shaggy Hiker View Post
    I don't think I understand the question correctly. If you open a solution in VS2022, then VS2022 is the version of VS used to open the solution. If the sln file indicates some earlier version, VS2022 doesn't magically become that earlier version, it's still VS2022.

    In older versions, back around 2010 and earlier, each time you opened a solution in a newer version of VS, there was an upgrade process that changed some of the files. This could easily mean that once opened in a newer version of VS, you could no longer open the solution in an older version of VS. Somewhere after 2010, that behavior changed such that opening a solution created in an earlier version of VS didn't change the solution such that you could no longer use that earlier version of VS. The newer version didn't change the solution in such a way that older versions were precluded, but the changes that were being made earlier didn't seem all that significant (unless you changed the targeted framework).
    Here, I am specifically referring to the Visual Studio Version Selector program. How does it choose an IDE when the version specified in the solution file icon is not installed on my system, but other higher or lower versions are available?
    FYI: I am not choosing the IDE manually here.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,984

    Re: How does Visual Studio Selector Choose the version of Visual Studio to open a Pro

    It appears that it opens the latest version installed. I have VS 2019 and 2022 installed and I just downloaded an old solution from one of my CodeBank threads. When I opened the solution file from File Explorer, VS 2022 opened without additional prompting. I can't test having an earlier version installed but it seems very unlikely that an earlier version would be selected unless there were no later versions installed. In that case, the solution may not open at all, although I don't know whether the VS selector would tell you that or the older VS version that it opened.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2020
    Posts
    59

    Re: How does Visual Studio Selector Choose the version of Visual Studio to open a Pro

    Quote Originally Posted by jmcilhinney View Post
    It appears that it opens the latest version installed. I have VS 2019 and 2022 installed and I just downloaded an old solution from one of my CodeBank threads. When I opened the solution file from File Explorer, VS 2022 opened without additional prompting. I can't test having an earlier version installed but it seems very unlikely that an earlier version would be selected unless there were no later versions installed. In that case, the solution may not open at all, although I don't know whether the VS selector would tell you that or the older VS version that it opened.
    It would be helpful if I could get proper Links/ Blogs/ Articles where the working of Visual studio Version selector is explained for above case. I have also explained a scenario above in my question , please do go thorugh it and help me out if possible.
    Last edited by IT_Researcher; Jan 9th, 2025 at 02:44 AM.

  6. #6
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,950

    Re: How does Visual Studio Selector Choose the version of Visual Studio to open a Pro

    When I use the version selector it seems to pick based on the version of the solution not the last installed. If that is what the OP meant:
    Attached Images Attached Images  
    Please remember next time...elections matter!

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,984

    Re: How does Visual Studio Selector Choose the version of Visual Studio to open a Pro

    Quote Originally Posted by TysonLPrice View Post
    When I use the version selector it seems to pick based on the version of the solution not the last installed. If that is what the OP meant:
    If the version that created a solution or last upgraded it is installed then it will open in that version. The OP is asking what happens when that version is not installed.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,947

    Re: How does Visual Studio Selector Choose the version of Visual Studio to open a Pro

    In my experience, the VS Version Selector just opens the .sln in the newest version of VS installed, which is really not what I want it to do…

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,984

    Re: How does Visual Studio Selector Choose the version of Visual Studio to open a Pro

    Quote Originally Posted by .paul. View Post
    In my experience, the VS Version Selector just opens the .sln in the newest version of VS installed, which is really not what I want it to do…
    It will obviously select the version that created or upgraded the solution first but it makes sense to me that, if that's not available, it would select the newest version available. I think that that's what most people would want most of the time. For the remaining cases, there's always 'Open With' in File Explorer or File->Open in VS itself.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  10. #10
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,947

    Re: How does Visual Studio Selector Choose the version of Visual Studio to open a Pro

    Quote Originally Posted by jmcilhinney View Post
    It will obviously select the version that created or upgraded the solution first.
    That's what I'm complaining about. It doesn't.

  11. #11
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,950

    Re: How does Visual Studio Selector Choose the version of Visual Studio to open a Pro

    Quote Originally Posted by .paul. View Post
    That's what I'm complaining about. It doesn't.
    I wouldn't know why it doesn't for you but, for me it selects the version that created or upgraded the solution.
    Please remember next time...elections matter!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width