WIX 3.0 Generate Features from .NET projects
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">
<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, Compo开发者_开发百科nents 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...)
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:
- 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.
- 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.
精彩评论