Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WIX Toolset integrated into VS 2012 beginner problems

My company recently forced us to use Wix Toolset (v.4.0.12), because we upgraded to Visual Studio 2012 which unfortunately no longer contains installer projects.

My problems are the following. I have a big solution with many projects which all in all result in an exe file, and several dlls.

I then create a Wix setup project in the solution, and add a reference to the project that produces the exe file. In the properties of that project reference I set Harvest: true and Project Output Groups: Binaries.

I would expect a build of my WiX project to harvest the dependencies from the referenced project, so that I do not need to manually add the references, as that would give me more maintenance.

Moreover, if I run heat.exe on the referenced project file, I only get the exe output of the file, and not the dlls which the project depends on.

I assume that the above is quite standard, and wix tools should be able to gather that information for me. And I really wonder why after an extensive search on the net, cannot find anyone with similar issues.

If anyone knows why the above, please try to send me a basic tutorial of how to do stuff with WiX. It seems impossible for me find an appropriate one.

like image 500
Jihad Haddad Avatar asked Mar 26 '13 09:03

Jihad Haddad


People also ask

What is WiX toolset used for?

Windows Installer XML Toolset (WiX, pronounced "wicks"), is a free software toolset that builds Windows Installer packages from XML. It consists of a command-line environment that developers may integrate into their build processes to build MSI and MSM packages.

Is WiX toolset open source?

The most powerful set of tools available to create your Windows installation experience. Free and Open Source since 2004!

Who uses WiX toolset?

Apple, EMC, IBM, Twitter, and thousands of other companies also depend on WiX. FireGiant co-founder and CEO, Rob Mensching, worked at Microsoft on installation technology for 14 years.


3 Answers

WiX v3.6 and later support VS2012. WiX v4.0 is barely even started and not recommended for use at this time. Lots of breaking changes coming in v4.0 so stick with the v3.x line for now.

The auto-harvesting feature in Votive is not fully functional. That is why it is disabled by default. Found many project types were breaking it. As you found, the harvesting does not walk through multiple project references. All things that need more work before they work properly.

In the meantime, you can list the File elements in Component elements.

like image 66
Rob Mensching Avatar answered Oct 07 '22 22:10

Rob Mensching


Not sure how you are using v4.0.12 when it's not even out yet! :) Wix v3.8 is the latest version: http://wixtoolset.org/releases.

There are plenty of guides in the official documentation and you can also find quite a lot of information in the tutorial.

However for your specific case you will need to manually include the outputs of each project and their dependancies into the installer as automatic harvesting isn't supported yet:

<Component>
    <File Id="ProjectA.Output"
          Name="$(var.ProjectA.TargetFileName)"
          Source="$(var.ProjectA.TargetPath)"
          KeyPath="yes" />
</Component>

<Component>
    <File Id="ProjectA.NlogDependancy"
          Name="NLog.dll"
          Source="$(var.ProjectA.TargetDir)\Nlog.dll"
          KeyPath="yes" />
</Component>

<Component>
    <File Id="ProjectB.Output"
          Name="$(var.ProjectB.TargetFileName)"
          Source="$(var.ProjectB.TargetPath)"
          KeyPath="yes" />
</Component>

<Component>
    <File Id="ProjectB.AutofacDependancy"
          Name="Autofac.dll"
          Source="$(var.ProjectB.TargetDir)\Autofac.dll"
          KeyPath="yes" />
</Component>

This isn't really that hard to do and unless you have several hundred binaries won't take you too long.

like image 43
caveman_dick Avatar answered Oct 08 '22 00:10

caveman_dick


I had a similar issue when i tried to create a .msi installation of my solution.

To overcome this problem and to make it long lasting over time even when I insert new .dll and other dependencies to my project and to make it automatic I did the following.

In my Product.wxs I have this "Directory"

<!--Here We Install Our Main App-->
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLFOLDER" Name="MyAppDir"/>
  </Directory>
...
</Directory>

and in my Wix project-> properties -> Build events -> Pre build event command line, I added this command:

 "%wix%\bin\heat" dir "$(SolutionDir)MainProject\bin\Debug" -dr INSTALLFOLDER -scom -frag -srd -sreg -gg -cg Components  -var var.MainProject.TargetDir -o $(SolutionDir)MainProject\Includedheat.wxs

Once I build my wix project it will create a Includedheat.wxs file in my MainProject directory that lists all the files from my MainProject\bin\Debug directory.

Next step - add the Includedheat.wxs into the wix project , than in my feature section I added:

<!--Add Component-->
<Feature Id="MainApplication" Title="Main Application" Level="1">
...
<ComponentGroupRef Id="Components" />
</Feature>

now once I rebuild and install the .msi all of the content that resided in my MainProject\bin\Debug directory will also be included in the MyAppDir dir on the target location.

For some more information: I followed this guides :

Create a working Wix project.

Easy way heat.exe.

Also recomending to read for detrming what flags to use in your command.

like image 40
Ravid Goldenberg Avatar answered Oct 07 '22 22:10

Ravid Goldenberg