Release v1.0.4.0

Rating: No reviews yet
Downloads: 119
Change Set: 5b1aa514b9fd
Released: Jan 18, 2015
Updated: Jan 19, 2015 by oleg_s
Dev status: Stable Help Icon

Recommended Download

Application WixSharp.1.0.4.0.7z
application, 10526K, uploaded Jan 19, 2015 - 119 downloads

Release Notes

New Features

  • Deferred Actions automatic property mapping
  • Importing *.reg file
  • Support for installed config file manipulations
  • Installing Windows Service
  • Support for absolute path in Dir constructor
  • Conditional auto-elements

Deferred Actions automatic property mapping

Deferred custom actions cannot access any session property as the session is terminated at the time of the action execution (limitation of MSI).
The standard way of overcoming this limitation is to create a new custom action for setting the property, set the property name to the name of the deferred action,
set the property value to the specially formatted map, schedule the execution of the custom action and access the mapped properties only via Session.CustomActionData.

All this can be done in a single hit with Wix# as it fully automates creation of the all mapping infrastructure.

The following is the example of passing the location of the MyApp.exe file in the deferred managed action.
var project =
    new Project("My Product",
        new Dir(@"%ProgramFiles%\My Company\My Product",
            new File(@"Files\MyApp.exe"),
            new File(@"Files\MyApp.exe.config")),
        new ElevatedManagedAction("ConfigureProduct", Return.check, When.After, Step.InstallFiles, Condition.NOT_Installed)
        {
            UsesProperties = "INSTALLDIR"
        });
...
[CustomAction]
public static ActionResult ConfigureProduct(Session session)
{
    string configFile = session.Property("INSTALLDIR") + "MyApp.exe.config";
    ...

In most of the cases you don't have to do anything for mapping as INSTALLDIR and UILevel are always mapped automatically.
Note UsesProperties holds comma separated list of properties which the custom action is intended to use.

Importing reg file
RegFile the registry file (*.reg) containing the entries to be installed.
Compiler uses the data from this class to call WixSharp.CommonTasks.ImportRegFile internally and inject imported RegValues into the project being compiled.
        Project project =
            new Project("MyProduct",
                new Dir(@"%ProgramFiles%\My Company\My Product",
                    new File(@"readme.txt")),
                new RegFile("MyProduct.reg"),


Support for installed config file manipulations
Implemented the complete sample (DeferredActions) dedicated for demonstrating various techniques of the post-install config file modifications.
[CustomAction]
public static ActionResult OnInstall(Session session)
{
    return session.HandleErrors(() =>
    {
        string configFile = session.Property("INSTALLDIR") + "MyApp.exe.config";
        Tasks.SetConfigAttribute(configFile,
      "//configuration/connectionStrings/add[@name='Server1']/@providerName", 
       "System.Data.SqlClient");
       ...


Installing Windows Service
Implemented new class ServiceInstaller. It combines functionality of ServiceInstall and ServiceConfig WiX elements. Samples library extended with two samples: one is showing how to install service from Wix# by susing the corresponding functionality of WiX and anothser one is relying on InstallUtil.
File service;
var project =
    new Project("My Product",
        new Dir(@"%ProgramFiles%\My Company\My Product",
            service = new File(@"..\SimpleService\MyApp.exe")));

service.ServiceInstaller = new ServiceInstaller
                            {
                                Name = "WixSharp.TestSvc",
                                StartOn = SvcEvent.Install,
                                StopOn = SvcEvent.InstallUninstall_Wait,
                                RemoveOn = SvcEvent.Uninstall_Wait,
                            };


Support for absolute path in Dir constructor
Now it is possible to pass the absolutre pass in to Dir constructor and the all necessary WiX infrastructure will be automatically created/adjusted.
var project =
    new Project("My Product",
        new Dir(@"C:\Utils\My Product",
            service = new File(@"..\SimpleService\MyApp.exe")));


Conditional auto-elements
In many cases Wix# injects special WiX elements (e.g. CreateFolder) just to satisfy non-obvious MSI/WiX limitations. If this such an injection is undesirable it can be switched off with the new AutoElements fields:
   AutoElements.DisableAutoCreateFolder = true;
   AutoElements.DisableAutoUserProfileRegistry= true;

Reviews for this release

No reviews yet for this release.