tags:

views:

301

answers:

1

I have a large .NET source tree (185 C# and VB projects, of which 60 are apps or websites) that i want to create a wix setup for. The general idea is to have 1 setup msi and to make each executable a feature, and to have each app be installed in a separate directory. like

%progfiles%/company/app1
                   /app2
                   /app3

so far i've managed to create a wix product file with the feature tree and to get the heat tool to generate fragment files for each .NET project. They look like this:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"&gt;
<Fragment>
    <DirectoryRef Id="Client.Binaries">
        ...component definitions...
    </DirectoryRef>
    <DirectoryRef Id="Client.Content">
        ...etc... 
    </DirectoryRef>
</Fragment>
<Fragment>
    <ComponentGroup Id="Client.Binaries">
       ...ComponentRefs referencing components defined under 
          the DirectoryRef with the same id...
    </ComponentGroup>
    ...etc...

However the linking of the two is giving me trouble, Features can reference ComponentGroups, ComponentGroups reference Components, Components are contained in a DirectoryRef.

Defining the Directory elements to be referenced by the DirectoryRef elements is giving me trouble.

Some libraries are used by multiple apps, so the DirectoryRef would have to be pointing to multiple directories, and multiple DirectoryRefs (with different ids) would have to be pointing to the same directory (found directory alias trick), both of which seem impossible.

I get the distinct impression I'm going about it the wrong way, or that I'm missing some deeper insight. (No suprise as my wix-fu is a full 3 days old)

Could someone enlighten me how to light the candle on this dark and wicked problem (no pun intended...)

A: 

It is not possible to install the same component to different locations if you use only one MSI. You could create multiple components for the same file, but that's a bit ugly and a maintenance headache.

A better approach is to install shared files only once. In the case of shared .NET assemblies, that means you should put them in the .NET global assembly cache (GAC). You need to do two things for each shared assembly:

  1. give the assembly a strong name by signing it; in Visual Studio you can just enable the "Sign the assembly" checkbox and generate a new key file from the project settings.
  2. in your wix source file, add a Assembly=".net" attribute to the File element

Once an assembly is registered in the GAC, it can be loaded by any of your applications.

Wim Coenen
Thanks for your answer, I think I'm going to take the easy route and put all the executables unix-style in the same folder, this has added benefits of easy configuration sharing by being able to separate the wcf, log4net and nhibernate out of the app.config's into a shared config file for each.I can live with the fact that this means that i need a separate setup for each website as there are only a few of those.
Remco Schoeman
Wcoenen, if there are multiple projects that require a dependent dll (one that you would install into the GAC), but then the GAC file has to change, does this mean that any project that is running would reference the old dll or would it break the running applications?
Scott
Scott: multiple versions of a DLL can live in the GAC side by side. The applications will load the exact version of the DLL they are compiled against, unless the system administrator "redirects" the dependency (e.g. for a security update)
Wim Coenen