WIX Toolset integrated into VS 2012 beginner problems
Asked Answered
N

3

7

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.

Nationalist answered 26/3, 2013 at 9:39 Comment(0)
D
8

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.

Diehard answered 26/3, 2013 at 15:3 Comment(1)
Is there any MSBuild task for Harvesting output? I think, I saw somewhere on net but can't find it now.Persecute
S
2

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.

Schreiner answered 26/3, 2013 at 12:4 Comment(2)
Hi. Thanks for your reply. Funny the version 4.0.12 is not listed, but I got it from here wixtoolset.org/releases/v4.0.12.0. Probably still beta, but presumably the only one that integrates into Visual Studio 2012. I have read a lot about my problem, and thought that heat.exe runs the a project's dependencies, but that is unfortunately not what happens. I will see if I should choose another installer. Thanks againNationalist
WiX 3.7 also integrates with VS2012. But this answer is still required at this time.Paresh
U
1

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.

Uncalledfor answered 8/11, 2015 at 8:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.