How to Fetch install directory from WPF Application

Dec 12, 2016 at 10:52 AM
I am working on bootstrapper UI as my benchmark and created new UI in WPF.
When the "Install Directory " property is changed ,I have added it in Static variables so that it can be accessed in setup.cs file.
Here Data variables is my static Class .I filled the values in the main screen .
But Msi file is created before user filling values.

It will be beneficial to many users as lots of user required this functionality.
static public void Main(string[] args)


    var productProj =
        new Project("My Product",
            new Dir(DataVariables.installationFolder +@"\My Company\My Product",
                new File("readme.txt")
                ) { InstallScope = InstallScope.perMachine };
    productProj.GUID = new Guid("6f330b47-2577-43ad-9095-1861bb258778");
    string productMsi = productProj.BuildMsi();

    var bootstrapper =
            new Bundle("My Product",                    
                new MsiPackage(productMsi) { Id = "MyProductPackageId", DisplayInternalUI = false });

    bootstrapper.Version = new Version("");
    bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889a");
    bootstrapper.Application = new ManagedBootstrapperApplication("%this%"); // you can also use System.Reflection.Assembly.GetExecutingAssembly().Location
    bootstrapper.PreserveTempFiles = true;