Projucer:Visual Studio 2022 RC starts even if Visual Studio 2019 is selected as the exporter

Write in Japanese. 日本語で書きます。
最近、JUCEに興味を持ち始めた初心者です。
よろしくおねがいします。
タイトルの通りです。
Projucerでプロジェクトを作成し、exporterにVisual Studio 2019を選択しても、Visual Studio 2022 RCが起動してしまいます。もちろん、Visual Studio 2019はインストール済です。他に、Visual Studio 2017もインストールしてあります。

slnファイルをProjucerで作成したものと、Visual Studio 2019で作成したものを比較してみると、二行目のバージョンに関する記述が異なることを発見しました。

Projucerのslnファイル

# Visual Studio 2019

Visual Studio 2019のslnファイル

# Visual Studio Version 16

試しに、slnファイルをテキストエディタで開き、「# Visual Studio 2019」を「# Visual Studio Version 16」へ書き換えて保存し、slnファイルをダブルクリックで開くと、Visual Studio 2019が起動しました。つまり、slnの記述が間違えている可能性があります。

Projucerのソースコードで「# Visual Studio 2019」を検索すると、jucer_ProjectExport_MSVC.hの1883行目がヒットします。試しに、ここの記述を「# Visual Studio Version 16」へ変更してビルドしたところ、Visual Studio 2019が起動するようになりました。
修正が必要だと思います。

また、Visual Studio 2017のslnファイルでも間違っていました。
Projucerのslnファイル

# Visual Studio 2017

Visual Studio 2017のslnファイル

# Visual Studio 15

同様に、修正が必要だと思います。

よろしくおねがいします。

Welcome and apologies for not writing in Japanese, I never learned it :wink:

Answering to the title:
The exporter selects what the format of the generated VS project is in.

The button start IDE simply calls the sln file, and Windows will select the Application connected to that file type.

I can’t read anything but the subject here, but…

On the PC, the Visual Studio that runs is the one associated with the .sln file type, I believe. So if you have two versions of Visual Studio, whichever one is the system default is the one that will launch. For me, that means VS 2017 always launches, even though I also have VS 2019 installed and use that exporter. So to get around this, I never launch VS from Projucer if I want to run VS 2019, but instead just Save from Projucer, and manually run VS 2019.

I would suggest that you change your system default to whichever version of Visual Studio you use more often, and launch the other one manually if you need to. (Or always launch Visual Studio manually, so you don’t have to remember which one is the default.)

回答ありがとうございます。
slnファイルの既定のアプリは、「Microsoft Visual Studio Version Selector」になっています。こうすることによって、slnファイルを作成したアプリを自動で判定してそのアプリで起動するようになっています。

具体的には、VS 2019で作成されたslnファイルはVS 2019で開かれ、VS 2017で作成されたslnファイルはVS2017で開かれます。

Projucerで作成されたslnファイルは、このようになっていないので、Projucerを修正する必要があると思います。

Thanks for the answer.
The default application for the sln file is “Microsoft Visual Studio Version Selector”. By doing this, the application that created the sln file is automatically determined and launched with that application.

Specifically, sln files created in VS 2019 will be opened in VS 2019, and sln files created in VS 2017 will be opened in VS 2017.

This is not the case for sln files created in Projucer, so I think Projucer needs to be modified.

Translated with DeepL Translate: The world's most accurate translator (free version)

I will repeat what has been said, Projucer does not launch an application, it asks the OS to launch the application that is associated with the file type. It is very unclear how the Projucer could be doing something different than that.

Do you refer to this code?

I believe this is a misunderstanding. The version number of VS does not correlate with the product name, so VS 2019 is version 16 and VS 207 is version 15.

Hope that clears it up. I never saw the VS version selector selecting a different version depending of solution file, but I could be mistaken.

1 Like

はい、そのコードです。

Yes, that code. (It’s a little different, it’s line 1883)

I had a quick look into this. It seems that the Visual Studio Version Selector uses the “descriptive comment” (the third line) of the solution file to determine which version of Visual Studio most recently opened the file. By adjusting the comment lines generated by the Projucer to match the “official” comments, we can get the Visual Studio Version Selector to launch VS2017 for VS2017 solutions, VS2019 for VS2019 solutions and so on. As a byproduct, the solution icon displayed in the Explorer also displays the correct version number, rather than a generic non-numbered icon.

Thanks for raising this. The change will probably be on develop in the next few days, once it’s been reviewed.

6 Likes

Thank you @shigobu, I learned now you can use the version selector like that. Seems I always had the sln set up incorrectly to open a specific version each time.

1 Like

対応ありがとうございます。
変更が適用されるのを心待ちにしてます。

Thanks for the response.
I’m looking forward to seeing the changes applied.

Thanks for your patience. The changes are available here:

You will need to rebuild the Projucer from the develop branch and then resave your projects in order for the change to have an effect.

1 Like