Add Visual C++ Redistributable for Visual Studio 2015 to InstallShield - c++

Issue
I have just set up my InstallSheild which works fine and i am just wondering how i can add the (x86) + (x64) version of this download : https://www.microsoft.com/en-gb/download/details.aspx?id=48145 to my InstallShield so the user has to install it.
I have tried to get this working on One-Click but this also does not work.
Has anyone tried adding this package to there InstallShield?

If its simple MSI project then you go into Application data/Redistributables search for desired package to add, probably needs to be downloaded first. When you check it it should be included and installed before feature selection, you can change this option in this view. (i dont have personal experience with this)
But i have suite project which includes c++ redist 2015. You can add it in Packages view, right click it and add new executable. You can map it from the installshield folder (where it was downloaded from the step i wrote above) or from the place you have downloaded it before.

You just need to add a prerequisite for Visual C++ Redistributable. In that prerequisite, you just need to mention a path of exe (files to include). You can set this path to the download location where you have already downloaded that exe.
So it will get added to your installer. And then while installation it'll get installed on target system on one click.

Related

Visual Studio: copy installation folder and setup it up to be auto-detected by Qt Creator

I wiped out an old Windows 10 and replaced it with a new Windows 10 by ISO image.
Before wiping out, I copied the folder of Microsoft Visual Studio 2017 Community Edition on old Windows to an external hard disk:
xcopy /E "C:\Program Files (x86)\Microsoft Visual Studio" D:\
Now after reinstalling Windows 10, I copied the VS 2017 folder from external the hard disk to the C:\Program Files (x86)\ folder of new operating system.
I did so to avoid having to download VS 2017 again on new OS.
The problem is other software, like Qt Creator, cannot auto-detect the VS C/C++ compilers. I guess that's because the VS 2017 isn't added to path.
The questions are:
What path should I add to system path in order to VS 2017 to be auto-detected by other software like Qt Creator?
Is there any script which I can run to automatically integrate the VS 2017 to the rest of the operating system.
To answer the questions in your issue:
Copying the content of C:\Program Files (x86)\Microsoft Visual Studio folder is not a recommended way to install VS.
(The complete installation will not only set the Environment variables but also set the related registry keys and values. A simple copy may break this process)
So we always suggest that users install the VS by vs-installer or offline installation package. (Same like what Zlatomir suggests.)
To your actual requirements:
It seems you're just trying to use VC++ compiler in QT Creator instead of developing QT projects in Visual Studio. So build tools for VS package is enough for you.
See this related issue, if we download Build Tools for VS package with corresponding C++ workload, then we can get the compiler the QT needs. There's no need to install the VS IDE for this situation.
And if we need C++ compiler from VS2017, download the Build Tools for VS2017, if we need C++ compiler from VS2015, download the Build Tools for VS2015 Update3. Link of old version about VS Tools see here.
Update:
From the the link older downloads we can see:
Choose the download button according to which version we need. We can find both VS2017 build tools package and VS2015's there.
Usually programs on Windows don't work after you just copy the installation folder.
So right now there is little you can do to fix it, even if you partially fix, you have no way to know if something else will be broken in the future.
So the recommended solution is to download the installer again and create an offline installer for the next time this happens, you can do that by running the online installer with the following parameters: vs_community.exe --layout c:\vslayout --lang en-US (replace vs_community.exe with the actual name of the online installer file, or rename it), for more options, that might require a smaller download (example if you only need native and don't need .net) check the documentation here for the full set of options you have.

Using libzip library from Visual Studio 2017 and cmake

I have a c++ program that was originally written in Linux. The program uses functions from the library libzip:
https://libzip.org
I am now working on a windows-based platform in Visual Studio 2017. Everthing works, as I could basically use the same cmake-files as I used on the Linux-platform. However, in Linux I used the package manager to install libzip. I do not have that option in Windows. I somehow need to build a Windows-version for libzip and include the files (header files and lib files) in my CMakeLists.txt file. Can someone help me with a step-by-step guide for this?
Take a look at vcpkg. It is a package manger for the Windows platform. It builds and installs many open source libraries for Windows. libzip is mentioned specifically as one of the ports.
Is it possible for you to use the Nuget Package Manager within Visual Studio?
right click on your solution
select "Manage packages for your solution"
search for libzip
select lipzip and click install
you should now be able to #include "zip.h"

How to set the default Windows kit (SDK) version?

I used to use Windows 8.1 SDK for my C++ application, and everything's working fine. Today I installed the Windows 10 SDK and I can't find a way to make it the default one.
I can hard-code the new SDK path in the Visual Studio project settings, but that is highly undesirable. I want the new kit to be used by default for every new project.
There's no environment variable for the SDK, and I can't find anything in the registry, either.
More precisely, there are Windows SDK entries in the registry, but what I need - the C++ includes and libraries - is called the Windows Kit (located in C:\Program Files (x86)\Windows Kits).
Ok, it seems not a lot of people face thist problem, but i'll still post a workaround to set default sdk version. It worked with Visual Studio 2017 Communtity.
Consider the following situation:
You've got a solution with projects you must not retarget
You had older VS installed earlier on your PC
When you open the solution, VS sets SDK version as 8.1 for some reason, while you use Windows SDK 10
When you try to build you have the following:
Error MSB8036 The Windows SDK version 8.1 was not found. Install the
required version of Windows SDK or change the SDK version in the
project property pages or by right-clicking the solution and selecting
"Retarget solution".
because SDK 8.1 is not installed properly on your PC, and reinstalling it somewhy does not solve the problem.
Others on your team don't have such a problem as the projects don't have Windows SDK version explicitly defined inside *.vcxproj files.
So, obviusly, MS build system with multiple SDKs installed has some kind of confusion, and the worst part is that it results in defining corruptly installed SDK as your default.
I used the following workaround to set default windows SDK explicitly:
Go to [VS installment path]\Common7\IDE\VC\VCTargets
,example:
C:\Program Files (x86)\Microsoft Visual
Studio\2017\WDExpress\Common7\IDE\VC\VCTargets\Microsoft.Cpp.WindowsSDK.props)
Open file Microsoft.Cpp.WindowsSDK.props as an administrator
Find line
<DefaultWindowsSDKVersion Condition="'$(DefaultWindowsSDKVersion)' == ''
and '$(AppContainerApplication)' != 'true'">8.1</DefaultWindowsSDKVersion>
change 8.1 to the SDK version you're sure you have properly installed, then save the file.
In my case it was 10.0.17763.0, so the final line was
<DefaultWindowsSDKVersion Condition="'$(DefaultWindowsSDKVersion)' == ''
and '$(AppContainerApplication)' != 'true'">10.0.17763.0</DefaultWindowsSDKVersion>
Now reopen your solution and try to build it. Should work fine.
My first troubleshooting tips would be to uninstall all the Visual Studio stuff you have, then reboot. Then install the latest version of Visual Studio. Then install any other SDKs that you need via the Visual Studio installer wizard. If you require to have Visual Studio 2015 and 2019 installed, go ahead and install 2015 before you install 2019.
If you want to change the project templates, you can in fact do that. The folder for the default templates is here:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ProjectTemplates\VC\WindowsDesktop\
Let's say you want to modify the ConsoleApplication template. Create a new project, in this new project edit the Project Property "SDK version" to be 8.1. Save the project and then go to Project->Export Template. Export the template. It will be a zip file in Documents\Visual Studio 2019\My Exported Templates. Unzip it.
You will notice the .vstemplate file in this folder which is similar to the found in the directory above. You will see in the node it will reference a .vcxproj file. In this .vcxproj file you will find the property:
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
Therefore in order to modify the default templates to match the template you just exported you will need to add the necessary files and lines XML from the My Exported Templates files and overwrite the defaults in Program Files. These will probably be overwritten each time you update VS tho.
Alternatively just extract the zip file of template you exported to the folder:
ProjectTemplates\VC\WindowsDesktop\
And you will find it in your templates after you reload visual studio

Adding dependencies to a setup project Win32 application Visual Studio

Hi I am looking to create a setup project for my Win32 application developed using Visual Studio 2013. I have created the setup.exe using InstallShield However now i also need to add dependencies which should be installed along with the required application when setup.exe is run.
The dependencies are simply Visual C++ Redistributable for Visual Studio 2015.
I went through this article for creating the setup.exe for my application. But I did not find any documentation which directs me how to add dependencies to this installer.
I found this document which describes a walkthrough for adding dependencies but that is no more possible in Visual Studio 2013 as much as I am aware. Now we 'NEED' to use Install Shield. Correct me if I am wrong.
Please direct me to some documentation which will guide me to add dependencies to my setup project.
UPDATE
I found in the InstallShield Project Assistant an option to check for installation requirements. But it requires you to specify the directory to search the particular file. As far as I know the Visual C++ Redistributable package is not installed in any particular location but the only way to detect its presence is to check if the registry key is set to 1.
So instead of checking I'd rather always have the setup file to install the Visual C++ Redistributable package no matter it is present or no.
But even for that how do I go about it?
There might be other reasons you need to use InstallShield that I'm not aware of, but in the simple case of a C++ app that needs the runtime as a prerequisite, I'd use Visual Studio 2015 (Community Edition will do) and add the Installer project extension. The project properties lets you build a prerequisite installer (a setup.exe) and among the choices are the VC++ runtimes. That's just an exe that does its checks and installs if required.
I'm not sure how you got a VC 2015 C++ requirement while developing with VS 2013. Again, VS 2013 also has a community edition and an installer project extension that will install the VS 2013 C++ prerequisites.
The redistributable installers have their own checks to see if they need installing. I wouldn't expect InstallShield to require you to know the detection rules of a C++ runtime. that's a bit odd. There may be another setting where you just say C++ runtime required.

InstallShield does not install VC++ redistributable on install

Using VS2012 to build the setup file and have VC++ redis 2012 as a requirement and when I go to run the installer, it does not prompt the user to install the package. I double checked that I have it selected in the redistributables section. I also made sure it wasn't already installed on the machine attempting to install it.
Not sure why Installshield isn't prompting for the install.
Open the InstallShield IDE. Under 'Application Data' click on 'Redistributables'. Find the desired redistributable in the window on the right and right-click on it. If that one allows you to do so, select 'Edit Prerequisite' and look through the tabs. Verify that 'Conditions' and 'Behavior' are correct.
For checked what is the problem that no let you install you prerequisite, try this:
When you generate you installer be sure that in the installer folder there is a folder with the installer of the prerequisite.
Execute individually the prerequisite installer (generated by installshield) in the target machine.
In my case I tried to install .Net Framework 4.5 in windows XP, when I executed this installer in the target machine this showed me an error "this frameowrk is not compatible with this system"