I'm using the CPack WIX generator to create an installer. The installer needs to install a file in a %ALLUSERSPROFILE%\foo\ folder on the target system.
I can't find a way to install files outside of the install tree (C:\Program Files\foo...)
How can this be accomplished?
I am not familiar with CPack, but the MSI System Folder Property for this is usually CommonAppDataFolder. So essentially you would use this as the target folder for the component hosting the files and resources you want installed in %ALLUSERSPROFILE%.
Folder Redirection: Without digressing too much, you should probably be aware that some of these system folder properties redirect based on whether the package is installed per-machine or per-user - relating to the value of ALLUSERS during installation. See link for more information ("Installation Context" and "Single Package Authoring" are illuminating). The folder you mention should be stable and not redirect.
Personal opinion: This folder redirection and per-user install feature are among my least favorite parts of MSI. My take is to install per-machine, whenever possible. Importantly (and the reason for this small rant): A package capable of installing per-user, should not target CommonAppDataFolder at all (since it does not redirect to a per-user target).
This is not possible at the moment. CMake does not allow to patch Directories at the moment.
See https://gitlab.kitware.com/cmake/cmake/issues/14890.
Related
Is there a way to backup the previous installed version of a .deb package generated by cpack?
I have a project that i need to deploy manually on multiple equipments in a live production site. To minimize error and time spent deploying, i would like to use cpack and a .deb generator to create a package.
But i also want to keep the previous installed version, and config files for fast roll-back.
I have already have a package with can be successfully installed with it's configuration files. Contained in a folder with the version as a name. But when I install the new version it automatically removes the older version. Is there a way to stop the installer from doing this?
I've solved my problem by moving away from the .deb package and I'm instead using the .stgz package with a custom script.
To create this script have a cmake folder in your project for cmake scripts. This is done by setting following line into your cmake file.
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Resources/CMake")
Copy a CPack.STGZ_Header.sh.in file into this directory. Normally you will find one in /usr/share/cmake-3.10/Modules/.
Edit this file at will to reflect it what you want to do. Make sure to leave the 3 line that really unpack your package untouched.
I am trying to repair an installed msi setup with below argument:
msiexec /f "msipath"
It is repairing properly. But while repairing i need to change its install path too. I tried this argument msiexec /f "msipath" INSTALLDIR="path"
But this is not working.
Whether it is possible to change the install path of an msi while repairing it?. If possible means, please share the exact argument.
It is not possible. For a component to be moved, it must be uninstalled and then reinstalled. (Repair just replaces resources in their original locations.) Consider this note on MsiSetTargetPath:
Do not attempt to configure the target path if the components using those paths are already installed for the current user or for a different user. Check the ProductState property before calling MsiSetTargetPath to determine if the product containing this component is installed.
Thus you typically have to remove and reinstall the entire package. A major upgrade can be a good way to accomplish that, depending on your other needs.
I have generated an MSI using Wix for the deployment we used octopus. While running the msi build through octopus some files like dlls, .. are not getting updated in the respective path for the first time of deployment. If we install the same for second time then works fine all the files placed in the folder.
These are the steps I have followed:
I have created a Wix project and generated a msi build through that. Then through the octopus using .xml file I have deployed the content in the specified folder. And deployment was not successful through octopus.
You really haven't given any information to troubleshoot. Are you using major upgrades or minor upgrades? What's your command line? Have you logged the installers and read through the logs? What do they tell you?
msiexec /i example.msi /qn /l*v install.log
/qn = silent /l*v = verbose logging
My first suspect is that you aren't versioning your DLL's correctly and that Windows Installer is skipping over them. Please see:
File Versioning Rules
Default File Versioning
Replacing Existing Files
I have an MSI that setups my application. It has a single component and installs only to %PROGRAMFILES% (no shared binaries). Simplified, it looks like this
Msi file, Monday build:
Program.exe (v1.0.0)
ThirdPartyLibrary.dll (v2.0.1)
Now, if I discover a bug in the program caused by my upgrade of the ThirdPartyLibrary dll from v2.0.0 to v2.0.1, and thus revert the reference to v2.0.0, it seems my MSI doesn't automatically replace the file in the installation directory?
Msi file, Tuesday build:
Program.exe (v1.0.0)
ThirdPartyLibrary.dll (v2.0) <- downgraded
What is the best practice here to ensure that the program folder always contains exactly the binaries in my setup? Should I a) wipe everything from the setup directory before copying the new files? Is there an option (in Wix) I can use that makes the msi force an overwrite of all files regardless of version?
What if I remove a file from the setup (a file that would cause errors if present at runtime), then the only way to have a working program after the setup, would be if it deleted all files first?
You can use a msi trick. In the File table in the msi database edit the Version column and enter a higher version, 3.0 for example. This way you will take advantage of the file versioning rules.
Looking for a way out of the corner my company has painted itself into.
Windows Services are currently installed by manually copying files around and running various batch files to install / uninstall. Locations differ by site and depending on whether the installed code is for production or test usage. So my debug build might need to install into
C:\someFolder\Site1\Test
while the Release build of the same code would install into
C:\someFolder\Site1
Currently only 2 sites but probably expanding soon.
I'm trying to put together a WiX install project (VS2010, WiX 3.5) to handle the installation. I'm not able to change the install folder definition (much as I would like to!) and I'm running into problems trying to understand how I might approach the problem. Being a newbie to WiX doesn't help.
For the question about release/debug versions:
At the place in your code where you are defining your target directory, you can conditionally set it based on the build version. For example, Debug is an available variable that can be used like:
<!-- inside of somefolder/site target definition, conditionally append test dir -->
<?ifdef var.Debug ?>
<Directory Id="TestId" Name="test" />
<?endif?>
You can also add other build dependent variables in visual studio for each type of release. This would be a unique build for each target situation model. This could easily get confusing to users about which version they should use.
The other model - one build with flexible target locations:
For the different site directories: Depends on how those sites are created.
If they exist previous to your install, just use wix's directorysearch to set a property used to build the target directory.
If instead the target directory is decided at install time, and its based on user's decision, then you'll need to prompt for the name or type (site). This will be similar to the typical situation of asking for a custom install directory. You can modify one of the sample custom wix dialogs included in the wix source that do this and add that dialog to your project's next/back flow.