2010-11-21 65 views
0

我有一个.NET 2.0项目winforms应用程序。我有另一个安装程序安装程序项目。自定义安装程序类中的System.Configuration

我已经添加了一个自定义安装程序类到WinForms应用程序,我想拉一些应用程序配置值来显示/允许用户在安装MSI运行期间更改。

我想用这个例子,因为它是有据可查的和有道理: http://raquila.com/software/configure-app-config-application-settings-during-msi-install/

我快到的万阿英,蒋达清是“System.Configuration”不给我“配置”对象。我有下面的代码代替:

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); 
     } 
    } 
} 

我试图获得最后的注释行工作,而它不工作...我不知道我做错了。

回答

0

添加对System.Configuration.dll的参考

+0

哦,我的天啊。我发誓我已经这样做了。我发誓我已经检查过......我发誓我看了又看了一眼。 – 2010-11-21 22:54:30

+0

哈哈,真棒:D – 2010-11-21 23:15:59