Wix custom action to unzip a file - wix

I've a zipped file which contains around 1000+ files.
I was able to bundle the zip file into msi.
But I would like to know how to unzip that file using any custom action

We had this requirement to unzip a file and place or the sub directories and files inside it at a particular location after installation.
Solution:
1. Create a exe (console app) that will unzip the file and place required files at required location.
2. Ship this exe with installer
3. Make this exe run (with execute sequence) while the application is installs.
This may add overhead, but this works.

Related

WiX - How do I copy existing files to a subdirectory before installed files of the same name overwrite them?

I have some file at Program\file.json, and I want my .msi to copy the file to Program\Backup\file.json before installing a new file at Program\file.json so that the old data is not lost.
I tried writing a Program\backup.bat which copies Program\file.json to Program\Backup\file.json and calling it with a CustomAction, but this does not work because I need to call the batch file after it is installed into the system's Program folder during InstallFiles so that it can move the old file. However, InstallFiles is also when the new Program\file.json overwrites the old one.
I also tried doing it the WiX way by putting the following tag in another Component within the same Feature as the File tag responsible for the new Program\file.json:
<CopyFile SourceDirectory="ProgramFolder" DestinationDirectory="BackupFolder" Id="Copy_of_File" SourceName="file.json"/>
("ProgramFolder" is the Id of the Program Directory, and "BackupFolder" is the Id of the Program\Backup Directory)
However, this appears to copy the old version into Program\Backup\file.json but not overwrite it with the new version. I'm not sure why.

Visual Studio ASP.NET Web API Precompiled files placed in a different folder with TFS

I have an asp.net web api project whose output needs to be packaged in a setup project using wix.
I would like to precompile the site. The problem is that the precompilation process generates variable file names (ie. *.compiled files in particular).
I also would like to build the setup in a TFS build.
It seems that my only option is to generate a .wxs file wihtin the prebuild step of the wix project.
The .wxs files source paths are using $(var._My_Web_Project_.TargetDir). This seems to be translated to a Sources based directory.
I'm using paraffin to do that already and it works perfectly fine when building the solution with visual studio.
When building the solution through a TFS build, the .compiled files are copied to a Binaries folder, whereas all the other related web site files are copied to a Sources based directory.
The build errors are like the following :
The system cannot find the file 'd:\BuildAgents\___basedir___\Binaries\___web_project_dir\_PublishedWebSites\___site___\bin\textsample.cshtml.c6fb271c.compiled'.
The file is indeed in the Sources directory.
'd:\BuildAgents\___basedir___\Sources\___web_project_dir\_PublishedWebSites\___site___\bin\textsample.cshtml.c6fb271c.compiled'
I think I somehow need to redefine the aspnet_compiler output or something like this, but can't figure out how to do that.
The msbuild command line arguments are the follwing:
/p:GenerateProjectSpecificOutputFolder=true /p:VisualStudioVersion=14.0 /p:DeployOnBuild=true /p:PublishProfile=local /p:CleanWebProjectOutputDir=False /verbosity:d
EDIT 1: I'm using XAML build.
Any help appreciated.
EDIT 2:
With the new task based build, it works as is (no need to use an additional Copy Files task).
The aspnet_compiler output the .compiled files in the correct folder :
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v / -p D:\BuildAgents\vNext\_work\1\s\Softs\__Solution__\__Web_Project\obj\Release\AspnetCompileMerge\Source -c D:\BuildAgents\vNext\_work\1\s\Softs\__Solution__\__Web_Project__\obj\Release\AspnetCompileMerge\TempBuildDir
In the new tasks based build system, it's easy to copy files from a source folder to a target folder with Copy Files task.
Source Folder: Folder that contains the files you want to copy.
Contents: Specify minimatch pattern filters (one on each line) that you want to apply to the list of files to be copied.
Target Folder: Folder where the files will be copied. In most cases you specify this folder using a variable.

How to copy directories/files in installed folder using wix

I have deployment files which are dynamic in nature. Sometimes I have 4 files and sometimes 5 files. I need to just copy those files in installed folder.
How to include those files in msi?
How to copy it in installed folder?
You include files in your msi by harvesting them with wix tool harvest tool set
Once you have proper msi file , you install it and that will copy your harvested files to the desired dir.

WiX Managed Bootstrapper “Failed to resolve source for file” for .cab files

I have an .msi package with 5 external .cab files in my bootstrapper application(not being compressed in my bootstrapper application, external) which installs well locally, and has DownloadUrl attribute for web-based installation.
But, when I execute my bootstrapper application without its .msi file and .cab files(not accompanied by them in the same folder, i.e., executed solely in a separate folder), it cannot download the .cab files although it can download the .msi file(log files says that).
So, I added <Payload> elements for each .cab file under <MsiPackage> element with DownloadUrl attributes set to their individual URL and Compressed attibutes set to no. And then, when I execute my boostrapper application solely, it downloads all its files well and installs well.
Should I manage all the <Payload> elements for .cab files in <MsiPakcage> manually? No automatic download for .cab files?
I had written only .msi file path in DownloadUrl attribute of MsiPackage element. But in the source code of Wix Setup BA there was a substitution '{2}' meaning the file name of payload. I followed that and it solved the problem.
For more info see this link.

PackageMaker Troubles

My PackageMaker project was generating a .mpkg file, but then, all of the sudden, when I go to build, it only generates .pkg files. The .mpkg files are actually directories into which I place my custom installer bundle along with an InstallerSections.plist file to specify the order in which my custom view should display. The .pkg files are not directories and I have no way to add my custom installer bundle to it.
Anyhow, something is awry as PackageMaker no longer lets me generate a .mpkg file. Any idea why that might be? Is there some other way I should be approaching this?
Thanks.
p.s. If you are thinking of suggesting I ought to check out this tutorial, please don't bother. It's way out of date. Thanks.
Your pmdoc is a distribution project, and you've set the pmdoc's minimum system version to 10.5. PackageMaker always generates flat packages in this case.
There are three solutions:
Choose “Install Properties…” from the Project menu, and set the pmdoc's minimum system version to 10.4. This is the go-back-to-.mpkg solution.
Use the Flat Package Editor (hidden inside the PackageMaker bundle) to add the custom installer bundle. The contents of a .pkg file are the same as, and lain out similarly to, those of a .mpkg bundle.
Since flat packages are xar archives, use xar to extract the contents of the .pkg file to a temporary directory, add the custom installer bundle in that directory, then use xar to re-assemble the .pkg file from the temporary directory.