I have an application which I have built in Visual Studio 2012, one part of which is in C# and one part of which is in C++. The GUI for the application uses a third party GUI control.
Consequently I have three dependencies that need to be checked for and installed with my project:
The Microsoft Visual C++ redistributable
The .NET framework 4.5
The GUI control
My installer for the project is currently built using WiX. Is there a way to make WiX do the following?:
At install time check for the presence of (e.g.) the C++ redistributable and install it if it is not present
Remove these components at uninstall (if and only if they were installed at install time, obviously)
If not, my guess would be that the answer is to create another C# project which can run each msi in turn, but I'd like to be able to do the whole thing through WiX - is it possible? If so, how?
WiX has added to its original purpose of being a Windows Installer toolset. It now has a bootstrapper/chainer/bundler/reboot manager/package manager, sometimes called Burn. In Visual Studio, it is accessible via the WiX Bootstrapper project template.
You'd need to have a WiX Setup project for your application. Then define a chain sequence for the four setups. VC and .NET should be marked permanent because you don't known if and when they should be uninstalled. Same thing probably goes for the GUI control. That leaves your application, which the bootstrapper will uninstall when it is uninstalled.
You could create a bootstrapper to install your application and its prerequisites.
WiX toolset provides all necessary tools for you to create a bundle that contains different packages, one of it would be your own MSI.
Have a look at Burn and the WiX toolset documentation. The How To Guides show ways to achieve exactly what you want, for example there is a tutorial describing how to Install the .NET Framework using a bootstrapper.
Maybe the Standard Bootstrapper Application is what you are looking for. Or have a look at customized Managed Bootstrapper Applications. For example the fancy Visual Studio 2012 installer is a WiX MBA. But be warned, in my opinion a MBA is a lot of work.
Related
I have been referencing the following tutorial for creating a Setup Project for WiX v3, however, most WiX tutorials on the internet are targeting a C# application as its base project. I am currently building a Visual C++17 Win32 application that I want to deploy (i.e. create a setup *.msi installer) using WiX, given how powerful WiX is.
Unfortunately, adding a reference to my C++ project yields a yellow bang exclamation point:
Moreover, when trying to reference an icon file, for example, in the Product.wxs file using $(var.TimeTrack.ProjectDir)\TimeTrack.ico reports that it is an "undefined predecessor variable." I have tried unloading the WiX Setup Project and tried validating that the yellow banged Visual C++ project reference is referring to the correct path in the *.wixproj file. The include path appears to be correct:
<ItemGroup>
<ProjectReference Include="..\TimeTrack\TimeTrack.vcxproj">
<Name>TimeTrack</Name>
<!-- More not shown. -->
</ItemGroup>
I did a bit of digging and I cam across this StackOverflow posting that indicated that WiX is dependent on .NET framework. In addition, there seems to be a lot of very old postings (e.g. example 1) on this topic and I just am not entirely sure if I am just misunderstanding something here. According to this post, the WiX project cannot refer to any C/C++ code, but this appears to be referring to "Custom Actions," which appear to be an entirely different topic (?).
All in all, am I doing something wrong or is WiX not capable of deploying C++ applications? Is WiX only meant for deploying C# applications?
WiX has a development dependency on .NET but not an install time dependency.
Files are files. WiX doesn't care if they are C, C++, VB, PowerBuilder, Delphi, .NET, NodeJS, Electron or whatever.
The main differences for .NET vs C/C++ is:
1) .NET typically requires you to check that .NET is installed or author a bootstrapper to install it.
2) .NET core can typically be packaged with the app privately without a system wide installation of .NET core.
3) C/C++ typically requires installing the VCRedist via a bootstrapper or statically linking the files into your application.
4) .NET is "AnyCPU" where as C/C++ is compiled for the platform. MSI is compiled for the platoform. This means for .NET a single x86 MSI can deploy a .NET app that might run 32bit or 64bit depending on how it was built. For C/C++ you might need to create a 32bit MSI and a 64bit MSI for your app.
I have a FOSS tool that helps with learning and authoring WiX. You can read about it here:
http://www.github.com/iswix-llc/iswix-tutorials
The tutorials only hav C# examples but pull requests are welcome. Create your C/C++ application and use a postbuild copy command to stage the files to the Installer\Deploy folder and everything else is mostly the same.
I have a redistributable msi my program needs to be able to run. So far I've created a launch condition. The condition it uses is under "Search Target Machine". This needs a component ID.
This page suggests I can only determine the component ID via MSI Spy, a tool that as far as I can tell is no longer available: https://msdn.microsoft.com/en-us/library/1s08hzfe(v=vs.80).aspx
I must use a Visual Studio Setup Project, and I must distribute the 64 bit end user runtime of slimdx from http://slimdx.org/download.php.
How can I successfully get a component ID, or alternately how can I bundle an msi as a prerequisite?
MSI Spy seems an odd choice! The "standard" tool for looking in MSI files is Orca, supplied in the Windows SDK/Kit, install from Orca.msi. There are others if you search.
Look in that MSI and go to the Component table, look for a component id that is always installed (if that can be determined) and use that guid.
Ths might help with the custom prereqs:
Adding Custom prerequsites to visual studio setup project
and support for custom prerequisites in setup projects has never bneen particularly good, even when the Bootstrap Manifest Generator was around.
This might be useful if you can figure out how to alter the manifest file to add your custom prerequisite, which is what the BMG tool did.
How to install redistributable with visual studio setup?
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.
I'm using the Visual Studio Setup project. If I go to the properties of the Setup project, it lets me choose which pre-reqs are required, at which point I choose the C++ Redistributable.
On some systems, this works fine - but recently my users are reporting that the install failed because "A newer version of Microsoft Visual C++ 2010 Redistributable has been detected on the machine."
What's the proper way to do this? Is Visual Studio's detection fouled up somehow and unable to detect C++?
Yuck, this is ugly. I was wondering what would happen after Microsoft gave up on the side-by-side install of the runtime DLLs for VS2010. Seems clear, the interwebs are full of this installer error. The biggest victim seems to be Microsoft itself with Streets and Maps failing to install.
I'm not aware of any security patches for it so I have to guess that you haven't updated to SP1 yet. And your customers use a product of a vendor that did. This is a battle that you're always going to lose some day. Do consider taking advantage of the app-local deployment for the DLLs, copying them in the same directory as your main EXE. Simply copy them from the vc/redist directory before putting the setup package together, no need to tick the prerequisite. You'll need:
msvcr100.dll and msvcp100.dll for the regular CRT
atl100.dll if you use ATL
mfc100.dll, mfc100u.dll, mfcm100.dll, mfc100u.dll if you use MFC (u = Unicode, m = managed)
mfc100xxx.dll where xxx is the 3 letter language code if you use MFC on a non-English machine
vcomp100.dll if you use OpenMP in your code.
Only disadvantage is that they won't get updated if there's a security patch. That could be an advantage too, depending on what color glasses you wear. If you're uncomfortable about it then keeping the machine that creates the setup package updated, including enabling Windows Update, is an important requirement.
The default Visual C++ 2010 Redistributable uses a Product Code for detection. So Visual C++ 2010 SP1 Redistributable is not detected as installed. This is why the package tries to install it and fails.
A good solution is to create your own custom prerequisite which uses a better detection criteria. Here is an article which may help you:
http://blogs.msdn.com/b/astebner/archive/2010/05/05/10008146.aspx
Visual Studio setup projects do not support custom prerequisite creation. However, it can be done by manually generating the required manifests.
You can find the manifests structure here: http://msdn.microsoft.com/en-us/library/ms229223(VS.80).aspx
These manifests can be generated automatically with the Bootstrapper Manifest Generator tool.
After generating the package manifests, you can add all these files (including the package) in a separate folder in the Visual Studio prerequisites folder, for example:
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\
This way Visual Studio will show the prerequisite in your setup project properties page.
I have an app that on first installer run needs a boostrapper where you can choose the language of the installed app, install .net framework if it's not there yet and some other prerequisites.
I've taken a look at the WiX How To: Install the .NET Framework Using a Bootstrapper
but I don't see how to use this for other custom prerequisites.
What's the best bootstrapper to use for this?
After the app is installed we have an update check on the app startup. if a new version exists we need to download it and upgrade the software.
This wouldn't be a silent upgrade because the EULA and some other stuff might change in the meantime so we still need a GUI for those checks in the updater msi. So i'm considering different options on how to do this.
My first thought was to have 2 separate installers.
The first one would be with the bootstrapper and full GUI, the other would be with minimal GUI for updates.
Is there a better option?
I'd also like the access to the update installer on the to be limited to only users that have the software actually installed.
i'm not quite sure of the best way to do this.
I'm familiar with the WiX upgrade process itself with the upgrade code etc... so that's not the issue.
I'm just looking for a way to design all this in the best way possible.
Any ideas are appreciated. I'm using WiX 3.0.5419.0 from Visual Studio 2008.
I've taken a look at the WiX How To:
Install the .NET Framework Using a
Bootstrapper but I don't see how to
use this for other custom
prerequisites.
You can use the same technique (i.e. the msbuild GenerateBootStrapper task) to install custom prerequisites, but you'll have to author your own bootstrapper packages.
One way to do this is to study the existing bootstrapper packages in C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\ (or the ones in the Windows SDK) and read the documentation of the Bootstrapper Manifest XML format. The bootstrapper generator tool might also be helpful.
As for auto-updating your application: it's not supported by wix. I believe there were once plans to add this functionality under the name clickthrough, but I don't think those plans ever matured. If they did, I can't find any documentation about it.