Error Creating a 7-zip installer package - installation

If this is not the correct place to ask this, I apologize.
I use 7zip to create an installer package. Recently, my computer was updated, and I can no longer get it to work. I use a Windows Installer from Visual Studio 2010 to create the installation package, which I add to a file called setup.7z. I have confirmed that the files are archived correctly. I then call
copy /b 7zsd.sfx + config.txt + setup.7z setup.exe
which packages everything into a single file called "setup.exe". Clicking on this would start the installer.
After the update, I can still make the file, and it looks just fine. However, if I try to click on it, I get a message saying 7-Zip: Unsupported method.
I have 7-Zip version 18.05 (x86) installed. Honestly, I am not sure where I got the 7zsd.sfx file, but do remember having to hunt it down. It has no versioning, but was last modified on 7/13/2007. I don't know if the version matters, since you shouldn't need 7-Zip installed since this is a self-extracting file. However, it may be that the older version isn't able to unzip something zipped by a newer version.

I think the problem is in different versions of 7zip and 7zip.sfx used. Unfortunately SFX file is absent in most recent 7zip packages.
Here is link to 7zip_extra from some old version that has both SFX file and .bat file to create the installer.
Works fine for me.

Setup Tools: Why 7-Zip? There is a plethora of alternatives for creating (real) setups - and several are free: How to create windows installer (several links to tools for creating all kinds of setups). Brief descriptions below as well - under "Alternatives" (free tools, or tools with free features). These tools have been tested extensively to ensure running with minimal dependencies. Just something to keep in mind and evaluate I guess.
7-Zip
Guess: first install the C/ C++ runtimes and see if the problem goes away. Next check the compression - and then the LZMA SDK
as described below?
Unsupported Compression?: 7-Zip: Unsupported method - use LZMA? I suppose this problem could still occur though that answer is a couple of years old.
Missing Runtime?: You might also want to do a dependency walker check on that setup.exe to see if it depends on something that is missing on the box (for example MSVCRT.dll - or another runtime library). Just download the tool. Easy to use. Or maybe first try to install commonly used C/C++ runtimes. Also, Dependency Walker is aging and shows garbage at times. There is the newer Dependencies - but it is not quite prime-time yet, but try it (click Releases tab). It has been updated to handle Windows API-sets and WinSxS (side-by-side assemblies). Note: several security software on virustotal.com detect Dependencies as a "risk tool, not a virus" (it is open source).
LZMA SDK: The 7zSD.sfx file would likely be from the LZMA SDK. And the command line you describe can be found in the main 7-Zip help file (not the SDK, but the one coming with the regular 7-zip installation). Section "-sfx (Create SFX archive) switch" : Command Line Version => Switches => -sfc (Create SFX Archive.
Alternatives
Visual Studio 2017: The newest, free version of Visual Studio: Visual Studio Community 2017 can create setup.exe files via its Microsoft Visual Studio 2017 Installer Projects (this extension must be installed after installing Visual Studio 2017).
WiX: The Open Source WiX toolkit can create setup.exe files with its Burn component. A WiX Burn ad-hoc sample- just to get the general idea - it has a learning curve. No GUI to help you, it is all XML-based. Use with or without Visual Studio.
Advanced Installer: I believe Advanced Installer can compile a setup.exe even in their free version. Despite a somewhat large download, I think this would work for you and be quick.
UPDATE on Advanced Installer: The free edition can only build MSI files, EXE bootstrappers can be built with the paid editions (any of them).
dotNetInstaller: There is also the dotNetInstaller Setup Bootstrapper - which I have never used. Here it is on github.com (source).
Inno or NSIS: These free non-MSI installers can easily create a setup.exe for you that has been
optimized for minimal dependencies. I haven't used them much, but they
are well-known. NSIS seems to create archive files compatible with Zip tools.
IExpress et al: There are security vulnerabilities that affect these self-extracting packages. Another reason I recommend a "real" deployment tool with dedicated resources to fix such things quickly, despite the niceness of having a setup.exe that can be opened directly in 7-zip.
File Extraction
On the topic of extracting files from setup.exe files of various types:
MSI: Extract MSI from EXE - all MSI files can be extracted, and setup.exe files created with WiX can also be extracted
NSIS & Inno: It looks like NSIS creates files compatible with 7-Zip (comprehensible compression), not so with Inno by the looks of it.
Some Links:
Wix and .NET Framework (prerequisites)
What is the difference between 7zip's 7z.sfx and 7zsd.sfx?
https://en.wikipedia.org/wiki/Self-extracting_archive#Overview : "For a decompression utility to correctly expand an archive of either
the self-extracting or standard variety, it must be able to operate on
both the file format and algorithm used. The exact executable code
placed at the beginning of a self-extracting archive may therefore
need to be varied depending on what options were used to create the
archive. The decompression routines will be different for a LZMA 7z
archive when compared with a LZMA2 7z archive, for example."

Related

Installing VC_REDIST.X86 quietly using InstallShield Lite

I have been pulling out what's left of my hair trying to install software that requires a C++ redistributable (2017 x86) using InstallShield lite.
To start with, I define a prerequisite To include the C++ redistributable. When a user attempts an install, the user interface always appears. Now this is not a real problem however, if the redistributable was already installed`or there is a newer version then it will fail with a message that it has failed and it wioll ask the user if he wants to continue or abort the installation. If he selects continue, the software installs fine. This is not very user friendly.
This happens despite the correct command line switches being used i.e. /q /norestart. If you do this at a command prompt manually, it operates as it should. In other words it installs it, or fails because it is already installed but tells the user nothing. This is the way it is supposed to work.
Now I tried doing this as a custom action at the end of the installshield script but then the install appears to hang on some machines and on others other errors.
Now the only clue that I can give, is that if I create an MSI installation, then it never prompts. However with a setup.exe install it acts as above. I have only been successful with the msi install if I am installing a 64 bit app. Never with a 32 bit app.
Can someone guide me as to what I am doing incorrectly?
Thanks
VCRedist: This C / C++ runtime (in various versions and flavors) is a pain indeed. I decided to write something up a while back to try to summarize a few things:
Wix per user installer to detect the Visual C++ 2015 Redistributable (please skim at least - not great, better than nothing I hope - deals mostly with detecting the presence of the runtime).
Merge Modules: Does Installshield Lite support merge modules? If so, you can install the VCRedist using merge modules instead of the VCRedist_x64.exe file. This is insufficient for UWP applications (the universal CRT) as explained in these links:
Redistributables for deploying C++ exe developed with Visual Studio 2015 on Windows 7
WIX merge c++ runtime
Do read the links directly above - they are quick reads.
Batch File: Another option would be to keep the VCRedist_x64.exe file separate from your main setup and to zip up your MSI and the VCRedist_x64.exe in a ZIP archive and put an Install.cmd batch file in there which will install the VCRedist first and then your MSI file? Not too neat - one would have to admit. I think you can make a self-extracting archive that would automagically invoke it, but I haven't done that in ages.
Just a mock-up batch file from link below (untested):
REM 1. Install VCRuntime
vc_redist.x64.exe /install /quiet /log "%temp%\Install_vc_redist_2017_x64.log"
REM 2. Install MSI
msiexec.exe /i MySetup.msi /L*v C:\MySetup.log /QN
Not sure about security fixes and that kind of stuff. Run Windows Update afterwards?
Security Fixes & Link to Download: There have been so many security fixes for this runtime, and it is usually installed on most machines, that I would frankly just link to the download of the latest version and have people install it themselves as a pre-requisite rather than bundling an obsolete version in my setup, but that isn't really sufficient unless your package is for corporate use only (in which case they prefer to install their own runtimes with full control).
Some Links (to find easily):
Command lines to install and uninstall silently the VC++ 2017 Redistribuables (installation command lines, untested by me)
The latest supported Visual C++ downloads (please check)
Microsoft Visual C++ 2017 Resitributable Package (x86) (please do read this)
How to prevent vc_redist.x##.exe (VS2017) from ambiguously failing due to pending reboot?
Visual Studio 2017 Installer Project - include VC++ 2015 Redistributable
There is always the WiX toolkit
Distributable Code for Microsoft Visual Studio 2017 (Includes Utilities, Extensibility, and BuildServer Files)
Mailbag: How to perform a silent install of the Visual C++ 2010 redistributable packages
Thanks for a comprehensive answer. I am sure it will help a lot of people. What I have found is that running vc_redist.x86 from the command line in quiet mode will indeed always work as it should. In other words, if it is not installed, it will be installed. If it is already installed or a later release is installed, it will just return with no complaints. That is not the case using InstallShield Lite 2018 (same for all previous releases).
However, there is a simple solution to get it to work as I found out. All one needs to do is to include the entry Hidden="1" in the behavior part of the PRQ file. So there will now be an entry that looks like this:
<behavior Hidden="1" Failure="4" Reboot="2"/>
This solves the issue. It no longer runs separately from the installshield installer with it's own GUI but rather the messages now appear in the menus in installshield and it operates exactly as if you ran it at the command line. No more errors.

LLVM: How to get up and running and use files in include/llvm/?

I've downloaded the binary for Windows (here: http://llvm.org/builds/), but this doesn't include any of the files, e.g., "llvm/IRReader/IRReader.h", that many tutorials use.
Now, I've downloaded the LLVM source (here: http://releases.llvm.org/download.html), but instructing Visual Studio to look up include files in "include/llvm" results in lots of errors: header files cannot be opened, because they have a cmake suffix.
How do I get up and running fast without too much configuration?
You will need to run CMake before you can do anything. That will create Visual Studio solution files, which you can then use the build the LLVM binary files from sources. Only after you have build the binary files, you will be able to develop further applications linking to LLVM.
There is a platform independent guide here, also there used to be a windows specific guide too, which I could look for later.
http://llvm.org/docs/CMake.html
For a first-time user of CMake I would recommend CMake-GUI, as it is much less of a hassle to use.
I think for starters one can use default settings. Just make sure to select the correct Version of Visual Studio, otherwise you might end up with incompatible solution files

MSI for Visual C++ 2015

I need to install redistributable Visual C++ 2015 on three hundred computers in a corporate office. Is there any way to convert EXE to MSI. It would save tons of time.
The Visual Studio 2015 and 2017 installers are built with the WiX toolset.
You can extract the contents of these with the dark tool:
+>dir /b vc_*
vc_redist.x64.exe
vc_redist.x86.exe
+>mkdir x64-extracted
+>c:\local\WiX-3.11.1-bin\dark.exe vc_redist.x64.exe -x x64-extracted
Windows Installer XML Toolset Decompiler version 3.11.1.2318
Copyright (c) .NET Foundation and contributors. All rights reserved.
vc_redist.x64.exe
+>cd x64-extracted
+>dir /b /s
....\vcredist-2015\x64-extracted\AttachedContainer
....\vcredist-2015\x64-extracted\UX
....\vcredist-2015\x64-extracted\AttachedContainer\packages
....\vcredist-2015\x64-extracted\AttachedContainer\packages\Patch
....\vcredist-2015\x64-extracted\AttachedContainer\packages\vcRuntimeAdditional_amd64
....\vcredist-2015\x64-extracted\AttachedContainer\packages\vcRuntimeMinimum_amd64
....\vcredist-2015\x64-extracted\AttachedContainer\packages\Patch\x64
....\vcredist-2015\x64-extracted\AttachedContainer\packages\Patch\x86
....\vcredist-2015\x64-extracted\UX
...
+>
This will contain the vc_runtimeMinimum_x64.msi along with a cab1.cab that contains the actual data and the vc_runtimeAdditional_x64.msi along with another cab1.cab with the MFC dlls.
Note that it will also contain a bunch of MSU files (under the ..\Patch\..) subdir, that contain operating system patches for a minimum version of the Universal C Runtime. The UCRT is the part of the C runtime library that is no longer VS version specific, but an OS component.
I looked for a solution for that, too but couldn't find a way.
I just deploy it with powershell with silent switch like this:
& "\\MyServer\path\vc_redist.x86.exe" /q /norestart | Out-Null
Have you tried to extract it, as in the this example?
You can use a tool that converts a setup executable file (EXE) into a Windows Installer Package (MSI):
QwertyLab's Exe to Msi Converter (Free): download
EMCO MSI Package Builder (Shareware): download
You can download and use an evaluation version during a trial period. If you would like to continue using the product after the trial period, you must purchase the license. License removes any trial version limitations, so you don't need to download another copy of the product.
MSI package are useful to be deployed via GPO of Microsoft Active Directory.
Also, There other approach than GPO using EMCO Remote Installer.
EMCO Remote Installer perform any complex deployment task with just a few clicks. The application automates software deployment and audit operations, so you can easily manage software across your entire network. Review feature list

How to include MFC and Visual Studio CRT libraries into MSI installer?

I'm trying to learn how to write MSI installer. I'm using WiX, and I'm curious. My application comes with the dependencies to the followign MFC and CRT libraries:
mfc90u.dll
msvcr90.dll
How do you install those?
There are some choices listed here. I recommend using the appropriate redistributables instead of installing individual DLLs.
With WiX 3.6 and later, you can create a chainer that runs multiple installers. You can create a VS project for that with a WiX Bootstrapper template.
Distibuting the vcredist dlls as private DLLs creates security risks for the user, and is discouraged, however if you distribute the version mentioned it must live in a subfolder of the app folder with a name specified in msdn docs. It is far better to use the vcredist exe (even if your app does not need all of the vc redist files),or the related msm. The location of the msm or private dlls is part of your VS installation and detailed in the VS redistribution license. The vcredist exe is available from microsoft's site. There are many different versions of the vs 2008 redist. Open your binary in a text editor and search for manifest to read the embedded manifest which details which version of the vcredist you need to deploy. Never take anything from the SXS folder. Regarding wix you can add the msm to your msi but there are issues with doing that. The prefered method is create a Wix bundle using the vcredist exe.

How to deploy a Win32 API application as an executable

How can I deploy my Win32 application as an EXE application so that others (who don't have VC++ installed) can use it?
I am using VC++ 2010 on Windows 7.
If you switch to "Release" mode when you compile your finished program (rather than "Debug", which you use for debugging it during development), you should get an executable that will run on a computer without Visual Studio installed.
However, that executable will still require the appropriate version of the C runtime library to be installed. For example, if you developed it in Visual C++ 2010, you will need version 10 of the CRT installed. This is a freely redistributable library, downloadable here.
So, you have several options for deployment:
Manual Deployment
Give people the bare executable file, and include the installer for the redistributable in another folder on the installation media. If they copy the executable to disk and cannot run it because they get an error message, they should install the CRT libraries from the included redistributable installer. Then the executable will run just fine.
This works great if you have relatively a computer-savvy audience, or you're deploying to a fixed range of machines (like across a school or corporation). But it doesn't work so well for general deployment to customers.
In fact, you don't even need the installer. You can just place the CRT DLLs in the same folder as your executable and it will run just fine. This is how I test apps I'm developing on clean VMs. It works like a charm. There's no need to run the CRT installer at all. You'll find these required libraries as part of your Visual Studio installation:
<Program Files folder>\Microsoft Visual Studio 10.0\VC\redist\x86
Automated Deployment
Create a setup program that automatically installs your application along with any dependencies it requires, including the CRT redistributable. This is what you see most commercial applications doing. I recommend it for anything but the most trivial of apps.
Full versions of Visual Studio 2010 (i.e., not Express versions) can create a Setup Project that you can customize as needed to work as an installer for your application. But this is no longer the recommended way to create an installer, and this functionality has been removed from the latest version of Visual Studio, 2012.
So I recommend using something else, even if you have an older version of VS where the Setup Project is available. No point in wasting time creating something you'll just have to update later. My personal favorite choices for creating setup programs are WiX and Inno Setup. Both are free, and extensive documentation is available online.
Creating simple setups that don't have to do very much is really quite straightforward—this is likely the case for you, as all you need to do is install the CRT redistributable if it is not already there. I'd be willing to bet money you can find a walkthrough or example online for how to do this in either WiX or Inno Setup.
If you need to do more complicated stuff, both of these setup packages support it. They are extensively customizable and very powerful, it just takes more work to get it all going.
Static Linking
If you absolutely need to be able to distribute a bare executable that is guaranteed to simply work when double-clicked, you will need to switch your project to statically link in the required runtime libraries. This means that all of the CRT code is actually embedded by the linker directly into your executable, and means that you don't have to redistribute the CRT libraries separately.
The disadvantage of this approach is that the only way to benefit from improvements, bug fixes, and security patches released for the CRT is to recompile and redistribute your application. If you dynamically link (the default), your app will automatically benefit from enhancements to the installed version of the CRT libraries. Microsoft strongly recommends against static linking.
To switch between these modes in Visual Studio, follow these steps:
Right-click on your project in the Solution Explorer and select "Properties".
Ensure that the "Release" configuration is selected in the drop-down box at the top of the dialog.
Expand the "C/C++" item in the TreeView, and select "Code Generation".
Change the setting of the "Runtime Library" option to "Multi-threaded (/MT)".
A further description on what these cryptic compiler switches mean and which ones you should use when is given in my answer here.
Final Note: The "Debug" versions of the CRT libraries are not redistributable, but that doesn't matter because you should always distribute the "Release" build of your app anyway, never the "Debug" build.
In general, the odds are pretty good your EXE file will run on any version of Windows you built it on or higher.
All bets off, for example, if you built using Visual Studio 2012 Professional on Windows 7, and you try to run it on Windows 95. But otherwise, you're probably safe :)
The best way to test if you have any dependencies is to install and run on a "clean machine".
The best way to get (and reuse) a "clean machine" is with a VM.
I recommend VMWare. But Virtual Box and Windows Virtual PC are also viable choices.
As far as an installer, I'd strongly encourage you to look at InnoSetup
I hope that helps!
Make sure you build in release mode. As Floris Velleman said, you're using unneeded libraries for standalone executable.
For more information, you can check Compiler Options (MSDN).

Resources