1

for my WPF-Project I want to create an installer with WixSharp. But I also want to install the same Project with different Names and configuration-files (DEV, TEST, LIVE).

Is this possible and how?
Do I need different Project-Guid's for each Installation?
If it's not possible: Is there a workaround?

Thx

StefanM
  • 49
  • 1
  • 5
  • [Here is an old answer that touches upon it](https://serverfault.com/a/66999/20599). And there is [a newer version](https://stackoverflow.com/a/51661060/129130). And I suppose [this somewhat related answer](https://stackoverflow.com/a/51073294/129130) could be thrown in. It all comes down to how much changes for each edition? Just config files? Do you install debug binaries with the DEV and TEST ones? If possible I would use separate setups for LIVE and "everything else" so that the test version can live side-by-side with the released version. This requires a lot of discipline and foresight. – Stein Åsmul Oct 27 '19 at 14:29
  • With too much interference between side-by-side installations (shared COM registration, shared config files etc... Too much to sort out and maintain), you could use the same or separate setup for both LIVE and DEV and just test on virtuals marking DEV setups as non-distributable for example (d or debug in file name). You would prevent DEV and LIVE from being installed on the same box using launch conditions or custom actions inspecting the system. – Stein Åsmul Oct 27 '19 at 14:32
  • Should have read your question better... Be aware that the setup and product name must be the same if you want minor upgrade patching to work. Major upgrades should work fine with different names. Often you can install all config files in different flavors outright for all setups (you exclude them from installing unless a special setup flag TEST=1 is set via command line) and your application launch can use the test or live files accordingly - even asking the user what files and config to use (if they are all present). Many ways. – Stein Åsmul Oct 27 '19 at 14:47
  • what exactly do you mean with product name? (the project-name in visual studio) if not: the product can have different names (eg. DEV_Project. TEST_Project, etc.). But how do I set this name (and guid?) before or after the build of the msi. I don't want that the user thinks about dev and test products. – StefanM Oct 29 '19 at 18:13

1 Answers1

1

Yes, it's possible for Wix & Wixsharp. What's you needs:

  1. Add CustomAction before ValidateProductID
  2. Change ProductName property in the session

CustomAction managed code example:

new ManagedAction(
    RenameProductName,
    Return.ignore,
    When.Before,
    Step.ValidateProductID,
    Condition.Always)
    {
        Impersonate = false,
        ActionAssembly = System.Reflection.Assembly.GetExecutingAssembly().Location
    };

CustomAction code source:

[CustomAction]
public static ActionResult RenameProductName(Session session)
{
    session["ProductName"] = "My new product name";
    return ActionResult.Success;
}
Sergey Vaulin
  • 722
  • 4
  • 16