I have a number of cmake based projects, that setup differently based on the version of VS in use.
However, in VS 2026, the property featureReleaseYear was introduced and does not exist on 2022.
In 2022, you could get the "year" via the catalog_productLineVersion, unfortunately in 2026 it now returns 18 (rather than 2026)
I also use the first section from the installationVersion property, which would return 17 or 18 (for 2022 or 2026)
One of the things I check, is to make sure that the CL and Link executables in use match the generator selected. When they dont, it typically means I launched the wrong development shell.
I also check that the CMake generator is correct "Visual Studio ${installVersion} ${catalog_productLineVersion}"
Unfortunately, since productLineVersion return 18 and not 2026, and featureReleaseYear doesnt return anything for 2022, it will now take custom logic to validate the cmake generator.
One of two things would be great.
Simplest, if the property doesnt exist on a release, just print an empty string
in my case
vswhere -property catalog_featureReleaseYear -format text catalog_featureReleaseYear: catalog_featureReleaseYear: 2026
The same for the other formats.
I have a number of cmake based projects, that setup differently based on the version of VS in use.
However, in VS 2026, the property featureReleaseYear was introduced and does not exist on 2022.
In 2022, you could get the "year" via the catalog_productLineVersion, unfortunately in 2026 it now returns 18 (rather than 2026)
I also use the first section from the installationVersion property, which would return 17 or 18 (for 2022 or 2026)
One of the things I check, is to make sure that the CL and Link executables in use match the generator selected. When they dont, it typically means I launched the wrong development shell.
I also check that the CMake generator is correct "Visual Studio ${installVersion} ${catalog_productLineVersion}"
Unfortunately, since productLineVersion return 18 and not 2026, and featureReleaseYear doesnt return anything for 2022, it will now take custom logic to validate the cmake generator.
One of two things would be great.
Simplest, if the property doesnt exist on a release, just print an empty string
in my case
vswhere -property catalog_featureReleaseYear -format text catalog_featureReleaseYear: catalog_featureReleaseYear: 2026The same for the other formats.