How to embed Visual C++ runtime required from third party dlls - visual-c++

I have a software that is coded in C#. It depends on two(!) third party dll which require Visual C++ 2008 and Visual C++ 2005 redistribute. Originally the installer was built in InnoSetup with all "vs200x_sp1_vcredist_x??.exe" embedded and run on install time. However since it lacks of some advanced features we decided to migrate to Wix Toolset.
The problem is, MSI was running in a more restricted environment, so I didn't figure out what is the best way to require those redistributable file being executed properly. I was tried to use merge modules instead but it didn't work - I can see that the files were installed but dependency walker shows that dll is still not link to the right version.
I think that WinSxS makes things worse at least in this case, since the software keep failing with some error message regarding "Windows Side by Side configiration (14001)" when I use the merge module approach.
So the question is:
Are there any way to build a MSI that runs a exe that install some prerequisites? I wouldn't mind those prerequisites being downloaded or just embedded.
I know that WinSxS information is stored in the manifest of the dll. So if I was permitted to remove the manifest information by the third party company, and use dynamic dll loading instead the problem could be resolved. However is this legitimate? Since I will then need to embedded the Microsoft dlls directally in the msi.
I have noticed one of the dll's manifest says its required version is "9.0.21022.8" but the one in my MSM file is "9.0.30729.6161". Is this the issue? If so can I resolve the issue by I modifying the manifest to allow the right version? I don't think this will cause the dll not working, anyway.

The msi file should install only your software. If you need to install pre-requisites, you should use a bootstrapper for it. Bootstrapper's responsibility is to install pre-requisites and it's not a task of your msi.
If you see that wix bootstrapper is complex you can try on a simple bootstrapper like the dotnet installer bootstraper. you can download it from
http://dblock.github.io/dotnetinstaller/

Related

Silent installation msi

0x80070652 - when installing VS 2012 C++ redistributables.
Hi All,
I have a weird issue for the last few days now, i've been looking for a solution in the forums, google etc.
So far, couldn't find a similar problem:
Scenario:
I have an "Basic MSI" project that deploy our company product.
everything worked OK till i needed to add installation of VS 2012 C++ redistributables.
i'm using the installscript to initiate a command line for installing it quietly - 'vcredist_x64.exe /q'.
if the custom action is being added to the execute sequance, the following error is coming from the "VS 2012 C++ redistributables. -
ERROR 0X80070652: ERROR_INSTALL_ALREADY_RUNNING.This error is due to Another installation is already in progress. Complete that installation before proceeding with this install.
if running it manually, regardless to the IS installation, everything is working perfectly.
Also, when the custom action is on the UI sequance - works great. - i cannot leave it on the UI sequance, since our product is being deployed quietly along with our product client.
I've been trying to change into a different project type - "installscript MSI"... Same error.
Please advise, thanks for any inputs.
Short Answer: You can't run this executable from inside your MSI for technical reasons, you should run them in sequence instead. First the executable, then your MSI (batch file or manually). Or you should make an executable that runs them in sequence (WiX Bundle for example).
VCRedist: The VS 2012 C++ redistributable vcredist_x64.exe is a WiX Bundle with a couple of MSI files inside. You are not allowed to run embedded / nested MSI files concurrently with the main MSI installation. Simple explanation here. Inline explanation: This is because MSI files install as a transaction that is supposed to be possible to roll back. Hence the file installation sequence locks the system to prevent other MSI files installing when one is already in progress.
Extract: You can extract a WiX bundle using the WiX toolkit's dark.exe: dark.exe /x D:\VCRedist vcredist_x64.exe. WiX toolkit must be installed and dark.exe must be in the path or you must specify its full path.
Setup.exe: The solution is to run the MSI files in sequence inside a setup.exe bundle created with WiX, Installshield (see link for sample screenshot - more on suite projects here), Advanced Installer or a similar setup creation tool. Another approach is to simply deliver the runtime next to your installer and install them in sequence with a batch file or even by instructing the user to do so.
Merge Modules: Most VCRedist versions have merge modules that you can use to install the runtime (as opposed to setup executables). WiX sample. These are merged into your own MSI at build time and hence feature no nested MSI processes. There are some issues with merge modules and recent VCRedist versions.
Links:
The latest supported Visual C++ downloads
Detect VC runtime presence
Similar answer

InstallShield "Full" Redistributable forces internet access

I used Flexera's InstallShield Express to bundle my software into a Setup.exe file. I included .NET Framework 4.7.1 redistributable (2. Specify Application Data > 'Microsoft .NET Framework 4.7.1 Full' is checked and highlighted in middle panel, and says 'installed locally' > 'Install before feature selection' is checked on bottom panel).
I went onto my fresh installed Windows 7 computer with no internet access and attempted the install. It gave me the error:
"An error occurred while downloading the file
http://saturn.installshield.com/is/prerequisites/Microsoft.NET Framework 4.7.1 Full.prq"
I then connected to the internet, and it was able to go through. I looked for a text of the prq. There may be a way to find it thru InstallShield, but I found a forum post from community.flexerasoftware.com asking about 4.7.2.
The two parts of interest are:
<file LocalFile="<ISProductFolder>
\SetupPrerequisites\Microsoft .net\4.7.1\Full\NDP472-KB4054530-x86-x64-AllOS-ENU.exe"
URL="https://download.microsoft.com/download
/6/E/4/6E48E8AB-DC00-419E-9704-06DD46E5F81D/NDP472-KB4054530-x86-x64-AllOS-ENU.exe"
FileSize="0,0"/>
and
<properties Id="{BFF4A593-74C5-482F-9771-7495035EBBB0}"
Description="This prerequisite installs the .NET Framework 4.7.2 Full standalone package."
AltPrqURL="http://saturn.installshield.com/is/prerequisites
/Microsoft .NET Framework 4.7.2 Full.prq"/>
The fact that the file reads '4.7.1' is another can of worms I need to explore (not in the scope of this question). I'm assuming all prq files have a common structure. I believe that this information tells me the URL (download.microsoft.com) was skipped and the AltPrqUril (saturn.installshield.com) was used during my install. But even if the URL were not skipped, it would still looking at a page on the world wide web.
Question
Why do I need internet connection? The 'Full' version is specifically different from the 'Web' version in that you do not have to connect to the internet to install it.
Avoiding Internet Connection Requirement
To embed runtimes in the setup.exe and hence avoid the need for
an Internet connection, you can try to set the option "Extract
prerequisites from setup.exe" in the setup.exe tab in the
Release view as illustrated in the second screenshot below.
Then you select the "Full" .NET Framework version in the
Prerequisites View. Not 100% sure what features the Installshield Express version has vs the full versions. The below is from the Premier version.
You can check your finished bundle, by doing a "setup.exe /a" -
from a command prompt - on the final
setup.exe and extract the files to see what is really included in the bundle.
Quick Reminder
I think you should generally call Installshield support if you have a support agreement, or check their own community at: https://community.flexerasoftware.com.
Just mentioning this since people sometimes forget to check whether they have support agreements and support & community might resolve your problems in 5 minutes - if you don't get answers here.
Release Wizard
However, just shooting from the hip I would propose that the cause could be this setting that is available in the Release Wizard in the regular version of Installshield 2018. It is probably similar in the Express edition:
In the Release property pages, it seems this setting is under the Setup.exe tab and it is called "Installshield Prerequisites Location":
[
Prefer Download
For what it is worth I really dislike old, outdated runtimes included in bloated setups. This has to do with my experience as a corporate deployment specialists where much of the day consisted of extracting outdated runtimes from vendor packages.
I would always suggest you download very common runtimes from the web, or allow them to be installed via Windows Update. That includes basically all Microsoft runtimes.
I only like to bundle runtimes if they are 1) Rare and special, 2) Stable and well tested, 3) Small and well-behaving. Even then I would prefer them downloaded and installed separately - to allow security fixes to be installed without rebuilding your whole setup - you just put up the new runtime version on your server (marketing will want a new build for physical release - that is just added risk if you ask me).
War story: the SOAP merge module - back in the day - almost destroyed my package with global deployment scope. Deployment errors quadrupled. Prerequisites can really ruin your work, and you will face little understanding for the problem seen. Try to make it clear what breaks and why. And get rid of all prerequisites you can (pie-in-the-sky thinking, I know). Certain runtimes are unavoidable of course. I just ramble on :-).

VC 2012 merge modules under Windows XP

We have a VC++ 2012 application for native Windows (classic fat app)
Also we have a NSIS based installer.
I would like to add the VC110_CRT merge modules to the installer but the merge modules cannot be installed on Windows XP. The error Message is.
This installation package cannot be installed by the Windows Installer service. Your must install a Windows service pack that conatains a newer version of the Windows Installer service.
and yes, Its a fully updated Windows XP (SP 3 + all updates). As far as I understand it, we need at least Windows Vista to install the update.
My Question:
Is there a way to convert the Microsoft_VC110_CRT_x86.msm module, so its usable under Windows xp
I know I can use the vs_2012_redist, but it has ~6,5 MB instead of ~0,8 of the merge modul size.
and I only need the CRT, because the app uses QT and no MFC/ATL/....
This is an incorrect error message. MSIEXEC is looking at the schema verson in the SummaryInformationStream of the MSM and seeing it's newer then the version of MSI on Windows and giving you this error message.
In truth, merge modules can never be installed because they have no concept of Product or Features. They are merely encapsulated collections of components and related installation metadata. Merge modules are like .LIB files in C/C++ and are statically linked (merged) into an MSI at build time.
NSIS isn't a Windows Installer technology so it can't use merge modules. Instead you should use the redistributable provided by Microsoft and launch the EXE with the correct command line.
You're only other options are to deploy the desired DLL privately (in your application directory), statically link it in your EXE or dump NSIS and create a proper MSI.
Be aware of the security / patching implications of your choice.

KB2465367 and 3rd party libraries

I'm using third party libraries that I obtained well before KB2465367 came out. My development computer has been updated with KB2465367 so all the binaries I generate seem to now be dependant on 8.0.50727.5592 of the CRT (the 2465367 version of the CRT).
Now, when I want to deploy this application I'm using the 8.0 CRT merge module (also updated by 2465367). This installs 8.0.50727.5592 versions of MSVC libraries (like msvcrt80.dll).
But, when I run my application on a machine that's never had the VC runtime installed, it complains about "This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem." I've traced this back to a system entry in the event log: "Generate Activation Context failed for C:\Program Files\MyCompany\MyApp.exe. Reference error message: The operation completed successfully." under the source "SideBySide".
Of course, this update has basically meant I'm dead in the water.
How do I proceed from here? Do my clients need to install 8.0.50608.0 version of the CRT after installing my application because the 3rd party libraries need 8.0.50608.0 and the MSM I used didn't include it?
In my circumstance I'm using How To: Install the Visual C++ Redistributable with your installer which only describes using a single MSM. It's recommended that a policy MSM also be used to redirect any DLLs dependant on older versions of the runtime.
See also http://lynk.at/jlqsKx
This is the same thing happened when MS rolled out KB971090.
A simple solution is to remove the KB2465367.
You can reference more information about KB971090 and KB2465367 at here.
There is an uninitialized data bug in the patch that can cause DLL load failure.
Your installation program have to use two merge modules:
The runtime libraries, and
The policy file which redirects all older versions of the runtime to the new version.
The redistributable package vcredist_xxx.exe installs both the latest version of the libraries and the policy files.
You cannot assume the VC libraries are available on users machines, therefore you always have to install them. Otherwise your application won't run.

How to properly install MS VC++ 9 runtime?

I have an application that uses the ms vc++ runtime. How should I install it on the end-user's system if it is not present? I was thinking of bundling it with the installer... but how would I do that as far as what to include? Is there some silent installer? If so, where can it be found? I can't seem to find it in the Windows SDK.
There is an interesting post about deploying the runtime libraries on the Visual C++ blog. The post is about VC8 so I'm not sure all the recommendations apply to VC9.
Here are your options according to Microsoft:
Use an .msi installer including the .MSM files for the VC
libraries you're using. These MSM
files install the libraries globally.
They also keep a reference count so
that the libraries are removed when
the last application using them gets
uninstalled.
Use "app-local"
deployment i.e. copy the
libraries and manifest files in your
application directory. This is a simpler
solution if you don't use an .msi
installer. Your app should still use the
system version of the libraries if they are more
up-to-date than your own.
Link everything statically (and avoid crt usage across dll boundaries)
Another option Microsoft discourage you from using is running the Visual C++ redist installer from your own installer.
I'm not sure what their reasons are. It will take a few extra megabytes and will not be reference counted but it still works very well AFAICT. You can pass the /q option to vc_redist_x86.exe to perform an unattended install (no user interaction).
It has it's own installation program. I've seen it usually run as a prereq step of a larger installer.
One way or the other, you need to list it in your manifest. So you might just as well deliver it as via SxS in your application rather than try to deliver a global copy to the target machine. SxS is a big hard subject, sadly. Hopefully someone will supply an answer with more details and I'll delete this one.

Resources