C# Setup Project Custom Action to save the installation directory to custom setting file
<p>I am trying to make an application using windows installer as it's install method. When the installation succeeds I want to get the path where the primary output is located that I configured in the installer. In my case the primary output is in the folder <code>[ApplicationData(Installroot)]\Bin\</code>.</p>

<p>I also have a custom settings file called App.Settings in 1 my Class Library which controls several settings like file locations who are relative to the install location.</p>

<p>So the idea is that when the installation succeeds it should call the App.Settings and save the install folder to the settings file.</p>

<p>I already made an Install class and put it inside the Class Library. I am not sure if it is supposed to be in that project though.
This is the code of the Install Class:</p>

<pre><code>using System.Collections;
using System.ComponentModel;

namespace WaspbaneModels
{
    [RunInstaller(true)]
    public partial class Installer : System.Configuration.Install.Installer
    {
        public Installer()
        {
            InitializeComponent();
        }

        public override void Install(IDictionary stateSaver)
        {
            base.Install(stateSaver);
        }

        public override void Commit(IDictionary savedState)
        {
            base.Commit(savedState);

            SettingsControl.BaseURL = Context.Parameters["assemblypath"];
            SettingsControl.Save();
        }

        public override void Rollback(IDictionary savedState)
        {
            base.Rollback(savedState);
        }

        public override void Uninstall(IDictionary savedState)
        {
            base.Uninstall(savedState);
        }
    }
}
</code></pre>

<p>In this code SettingsControl is the class that takes care of the Settings simply with some properties. I used this class so that my Windows Forms project also can access these settings.</p>

<p>In the Custom Actions tab I also added the Primary Output to everything. I am also not sure if this is correct because I think the Primary Output contains all .dll files including the Class Libraries.</p>

<p>I am not really sure where to continue from this point however because the Settings are not saved. I simply check this by putting up a messagebox at the startup of the application giving me the value of the setting.</p>

<p>Anyone interested in more data of the project just ask. I just won't post everything at once yet.</p>

<p>EDIT:</p>

<p>After some more testing I managed to find out that the Installer class isn't being called upon. I added something that would write out to a file when the method would've been called but nothing happened.</p>

<p>Therefore my question now is: How do I add the Custom Action to the Setup project properly?</p>