Polyfun
Polyfun

Reputation: 9639

How to get a Wix installer to update an app.config with bindingRedirects

I have a Wix 3.0 project that installs some .Net assemblies into an existing application. As part of the installation, I need to update the application's config file with bindingRedirects so that the correct assembly versions are used, e.g.,

<configuration>
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="MyAssembly" publicKeyToken="deadbeefdeadbeef" culture="neutral" />
            <bindingRedirect oldVersion="1.0.0.0-1.0.10.0" newVersion="1.0.10.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

This will redirect bindings to MyAssembly versions up to 1.0.10.0 so that they go to the installed version 1.0.10.0. The installed version number (newVersion) changes over time, and so has to be determined at install time.

Cheers.

Upvotes: 1

Views: 2028

Answers (1)

Stephen Cleary
Stephen Cleary

Reputation: 456577

You can use the XmlFile element to update an XML file during a WiX install.

However, be sure to include the config file in the same component as the exe file (as a companion file); otherwise, there may be problems during upgrading.

Upvotes: 2

Related Questions