简体   繁体   中英

System.Configuration in a custom installer class

I have a .NET 2.0 project winforms app. I have another setup installer project.

I've added a custom installer class to the winforms app, that I want to pull some app configuration values to display/allow the user to change during the setup MSI running.

I'm trying to use this example, as it's well documented and makes sense: http://raquila.com/software/configure-app-config-application-settings-during-msi-install/

The probelm I'm running into is that "System.Configuration" is not giving me the "Configuration" object. I have the following code in place:

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Configuration;


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

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

            //get the custom settings

            //System.Diagnostics.Debugger.Break();

             System.Configuration
            //Configuration config = ConfigurationManager.OpenExeConfiguration(exePath);
        }
    }
}

I'm trying to get the last commented line to work, and it's not working... I'm not sure what I'm doing wrong.

添加对System.Configuration.dll的引用

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM