I'm filtering through existing questions, but none that I see answer this definitively on this basic level. I'm building my WXS files in notepad, not from an IDE.
Me scenario is: I have multiple applications that use some of the same assemblies. These assemblies are installed to individual application folders with the exe, so they are not shared among each other. They may be different versions. Folders look like:
App1: main1.exe, 1.dll, 2.dll
App2: main2.exe, 1.dll
App3: main3.exe, 1.dll, 2.dll
I'm templating my WXS files, but before I get too far, I am trying to figure out if I can copy/paste Component elements across applications.
App1.wxs:
<Component Id='AudioLibrary' Guid='1111-1111111-1111111-11111' Win64='yes'>
<File Id='AudioDLL' Source='1.dll' KeyPath='yes' />
App2.wxs
<Component Id='AudioLibrary' Guid='1111-1111111-1111111-11111' Win64='yes'>
<File Id='AudioDLL' Source='1.dll' KeyPath='yes' />
Will these two entries interfere with each other in upgrade/uninstall actions across the different applications?
Usually, database structures allow this type of duplication, because the parent would be the unique product guid. But I see a lot of complaints that MSI must have been written in the '70's when everyone was high on acid. So before I waste days building everything out, checking to see if I'm setting myself up for failure.
edit: I also want to include apply this to SQL script Components; can I copy/paste a snippet into any wxs file without having to generate a new GUID for it as well?
I forgot to come back to this...sorry.
Through reading Stein Åsmul's links, I determined the solution is to not provide a GUID at all.
I'm not sure if it's because it's hierarchical, and it inherits the parent GUID, or it just generates and assigns new GUID. If the latter, that may be a problem if you are doing patches, so do additional research. When I build and run a new installer, MSI says "Preparing to remove older versions", so be forewarned. It doesn't matter in my case.
My node has UpgradeCode=THEGUID. Components are self-explanatory, and my template wxs has these three and a few others. This allows me a fully functioning template where I just need to replace a few variable values and trim off Components that the project doesn't need.
<Component Id='MainExecutable' Guid='*' Win64='yes'>
<File Id='AppEXE' Source='$(var.ProductName).exe' KeyPath='yes' />
<File Id='AppPDB' Source='$(var.ProductName).pdb' Hidden='yes'/>
</Component>
<Component Id='CoreLibrary' Guid='*' Win64='yes'>
<File Id='CoreDLL' Source='Core.dll' KeyPath='yes' Hidden='yes'/>
<File Id='CorePDB' Source='Core.pdb' Hidden='yes'/>
</Component>
<Component Id='AudioLibrary' Guid='*' Win64='yes'>
<File Id='AudioDLL' Source='Audio.dll' KeyPath='yes' Hidden='yes'/>
<File Id='AudioPDB' Source='Audio.pdb' Hidden='yes'/>
</Component>