Programmatically determine if future versions of Visual Studio runtime are installed - visual-studio

When deploying software with the Visual Studio redistributable 2015, if a more recent redistributable is found, the user is presented with a confusing dialog box that implies that something is wrong with the software.
To avoid this, when deploying software with the 2015 runtime, the developer must first check for the existence of more recent versions of the Visual Studio runtime, by polling the registry, and avoid the install attempt if a newer version is found.
For example, here are some checks on a 64 bit system for Visual Studio 2015/2017:
//Check for VS2015 on x86 architecture
if(installer.value("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\
VisualStudio\\14.0\\VC\\Runtimes\\x86\\Installed") == 1)
{
doInstall = false;
}
//Check for VS2017 on x86 architecture
if(installer.value("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\
VisualStudio\\15.0\\VC\\Runtimes\\x86\\Installed") == 1)
{
doInstall = false;
}
if(doInstall===true)
{ //Install }
(Written in Qt for installscript.qs)
You can see the check differs only by the version number, and this currently holds true for all the existing Visual Studio runtimes. I can poll any existing version of Visual Studio and confirm if that install is present by simply changing the version number.
So for now, it's a simple case of checking if 2015 or 2017 exist, and react accordingly.
The problem: After I have released my software, there will certainly be later versions of Visual Studio that I am not currently testing for. I need to future proof my release so that my installer does not attempt to install the Visual Studio 2015 redistributable if there is a hypothetical Visual Studio 2020 already present.
At the moment I feel the only solution is to add in a whole bunch of tests for these hypothetical Visual Studio versions, following the naming convention and going up to some large number that will cover the intended life of the program.
This looks like a Y2kbug type mistake. It feels like there should be a better way. I can't seem to find any posters even considered this problem, let alone solutions for it, so I'm guessing there must be some commonly known, obvious solution, that I'm just missing.
My best guess is that there might be a common registry key that simply indicates if 'any' Visual Studio product is installed, but I have yet to find one.

I would personally regexp parse the version from the path VisualStudio\\**15.0**\\ and then test if myRequiredVersion>ParsedVersion. There is always a possibility that MS (or any company) goes haywire with naming conventions and change the whole path in the future, but that is the risk with everything really. You should maybe ask the user anyways whether he knows there is (newer) runtime/redistributable and allow installing even if you cannot find a proper match.

Related

What is background build in Qt VS tools

Relates to Error while using Qt in Visual Studio 2019
I have the same error. Unfortunately I cannot still fix it, as Qt VS Tools for VS 2015 aren't updated. But my question is not how to avoid background build.
My question: what is background build?
Oh, I believe you are running into the 32767 names for this.
Let me preface this by stating that 2015 may have been the last time I used Visual Studio or developed anything for a Microsoft platform.
Part of your answer is in this discussion.
I believe the latest (or more current) name for "background build" is "live code compilation."
This is a resource robbing, highly annoying, syntax checking thing Microsoft thought would be great. It ranks right up there with Microsoft Clippy as far as tragic ideas go.
Basically, as you type, visual studio tries to build your stuff, puts squiggles under errors and generally consumes a whole lot of resources.
If you are using that Qt plug-in to build a QMake project this can cause all kinds of hardship, especially when you have UI files that need to MOC compile and are in the designer modifying the .UI file.
Whatever version of Visual Studio I was forced to use for that project, the first thing I did was find out how to turn that off.
Qt appears to not play well with Visual Studio it seems.
Here is a more complete description if you happen to have the plug-in.
BuildOnSave is an extension for Visual Studio 2019 and 2017 that
builds the current solution as soon a file is saved, and in
combination with the the extension SaveAllTheTime, enables a live,
background build experience while you type.

What can I scrape off the Visual Studio 2015 installation package (like SQL) and still leave it functional?

What can I uninstall from this large chunk of programs without breaking Visual Studio Community 2015. I do not use any SQL services or any .NET frameworks for any sort of development, so I don't need SQL or .NET features. Unfortunately VS forced them upon me.
In fact, I only really use Visual Studio to code C/C++ and Fortran, and have no use for its other features.
In search for a solution I came across this cool preview build which would almost exactly be the solution to my predicament, but I need Intel C/C++/Fortran compiler and Intel Visual Fortran (extension for VS) compatibility to be maintained. Intel does not support non-official releases so VS Preview won't do.
Did you install the VS 2015 through the default installation or custom default? If you chose the default installation, those installed items in your first screenshot should be required for the VS 2015, it is better to keep it to make the VS work stable.
If you chose the custom installation, please have a look at the article and it lists the custom components, then you can remove them if you do not need it anymore. To remove them, you can right click the VS 2015 item under Uninstall a program list table and choose Change-Modify, then uncheck the checkbox of those components that you selected in your original custom installation, then the VS installer will auto uninstall those components. Before you try to uninstall any components, I recommend you backup your Windows OS firstly, you can find the backup method per your OS edition search here.
The .NET Framework is required and the basic component for VS, when you try to create any project types in VS, there is a default .NET Framework version like the following:

Visual Studio 2015 custom install does not include Visual Basic?

There is no option to install the Visual Basic language when choosing "custom" install of Visual Studio 2015. I really need to do a custom install, but I also really need Visual Basic!
What a ridiculous fail by Microsoft, unless I'm missing something obvious here?
"A Custom installation automatically includes the components that are in a Default installation."
So as per following, C# and VB always get installed.
MSDN Guide on Installing VS 2015
You misinterpret what you see, support for VB.NET and C# is always installed. There is no option to not install them.
Not 100% sure why they are not optional but high odds that if it were then the diskspace savings would not be substantial enough. Lots of the plumbing is already provided by the .NET Framework and MSBuild, they always need to be installed since VS itself depends on them. The only thing that could be skipped are the language services and the project templates, saves but a few handful of megabytes.
Trying to channel why you would ask such a question and not simply let it rip, if you discover that after installation you do not have VB.NET support then the install did not go well. That's a pretty common problem, almost always caused by having a beta or trial version installed previously and not uninstalling it correctly. That is a difficult problem to recover from, there is a lot of junk in the registry that should be reset/deleted. The usual way to recover is to run the original installer from the command-line with the /uninstall /force options.

Best Practice regarding VC Runtime

Let us take VS 2010 as example. I have an app and that needs to be deployed on the end user's system. I have the following algorithm:
1) If the code is built using Visual Studio 2010 (without SP1) then
the installer needs to check/install atleast VC++ 2010 runtime
10.0.30319.
2) If the code is built using Visual Studio 2010 SP1 then the
installer needs to check/install at-least VC++ 2010 runtime
10.0.40219.
I know that the latest Service Pack(SP) of VC++ 2010 runtime would support the apps developed using non-SP/old SP Visual Studio 2010.
Thus, is it not the best practice to install the latest version of VC++ Runtime on the end user machine, irrespective of the Service-Pack-status of Visual Studio? I feel this will be the safer option when it comes to security etc..
Please enlighten me.
Consider the VC runtime as yet another module in the system, not different from a regular application for the aspect that interests you. Just like for an application, in general you should always have the latest version since it should (at least in theory) be more stable, has more features and less bugs. That said, if you know that a specific version contains a critical bug or a change that interferes with your usage model (e.g., it was freeware and became shareware), you should skip it or adopt your software accordingly.

Have anyone succeeded in ThinApp'ing Visual Studio?

The purpose is to have a USB flash to have a developer seat everywhere. The idea is to use application virtualization to package Visual Studio.
However, AFAIK, there are big problems.
Have anyone succeeded in packaging Visual Studio (2010, 2008) using ThinApp, App-V, ...
P.S. I'm aware of google.
This is not possible. There's nothing "thin" about Visual Studio, it has an enormous mass of files in many different directories and a very large number of critical registry entries. Including many COM components. That it works as well as it does is one of the modern day's Seven World Wonders of software engineering.
Your license allows you to install VS on more than one machine as long as only one user uses it. I recommend you take advantage of it.
It is possible to install Visual Studio 2013 in App-V, it takes a lot of time to load and takes about 3Gb in .dat file. Compiling and debugging in C++ tested and works but really slow. No errors or popups for missing components so far. After experimenting I made a final virtualization script that works. p.m me.
It is possible to make Visual Studio portable version using VMWare Thinapp. No installation will be needed for Visual Studio, .net Framework or any other dependency. It works with Visual Studio Express edition 2008 as I have experimented but for version 2010, it say "Invalid Licence Data. Reinstall...". If you find a way, please tell me!

Resources