Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including all dependencies

Tags:

I'm just starting out with WiX as I need to be able to automate building an MSI on our CI server. Is there anyway to automatically include all the dependencies of a project?

like image 408
Chris Canal Avatar asked Nov 19 '08 16:11

Chris Canal


3 Answers

The "proj" extension to heat.exe is getting better. Heat isn't quite ready to be used for production in an automated fashion. It's a very reasonable way to get the initial structure put together but doesn't quite do the right thing with repeated runs (for example, Component/@Guids aren't stable, yet...).

When the above issues are solved in heat.exe then incorporating it into your build process will certainly save all the trouble that people mention above. It's on our list to do better after the most egregious bugs are fixed in the core toolset.

like image 135
Rob Mensching Avatar answered Nov 06 '22 11:11

Rob Mensching


I just started with WIX also and I did a quick-and-dirty trick to add references automaticaly. The idea is to scan all .dll in the output folder of the project you want to package.

In pre-build of your WIX project, add

call "$(ProjectDir)GenerateDependency.bat" "$(SolutionDir)" "$(ProjectDir)Dependencies.wxs"

Add a GenerateDependency.bat file in your WIX project containing

@echo off
set SOLUTIONDIR=%1
set OUTPUTFILE=%2
echo Starting Dependency check...
echo ^<?xml version="1.0" encoding="UTF-8"?^> > %OUTPUTFILE%
echo ^<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"^> >> %OUTPUTFILE%
echo   ^<Fragment^> >> %OUTPUTFILE%
echo     ^<ComponentGroup Id="MesDependance" Directory="INSTALLFOLDER"^> >> %OUTPUTFILE%

for %%F in (%SOLUTIONDIR%WixServiceInstallerExample\bin\Debug\*.dll) do (
   echo "-- Adding %%~nxF" 
    echo       ^<Component Id="%%~nF"^> >> %OUTPUTFILE%
    echo                     ^<File  Id="%%~nF" Name="%%~nxF" Source="%%~dpnxF" Vital="yes" KeyPath="yes" DiskId="1"/^> >> %OUTPUTFILE%
    echo       ^</Component^> >> %OUTPUTFILE%
)
echo     ^</ComponentGroup^> >> %OUTPUTFILE%
echo   ^</Fragment^> >> %OUTPUTFILE%
echo ^</Wix^> >> %OUTPUTFILE%
echo Dependency check done.

Modify the "WixServiceInstallerExample\bin\Debug" according to your need. This soulhd be the output folder of the project you want to package

Note : Beware that often VisualStudio mess around with encoding. Better edit this file with Notepad++ and make sure its in ANSI, not UTF8.

This will generate a Dependencies.wxs that you can include in your project. If you are under source control, exclude it from it.

Each build will rescan .dll and rebuild the Dependencies.wxs before actually making the package.

like image 41
Eric Craeymeersch Avatar answered Nov 06 '22 12:11

Eric Craeymeersch


Have a look at paraffin, from Wintellect.

like image 31
Ivaylo Bratoev Avatar answered Nov 06 '22 10:11

Ivaylo Bratoev