Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 131759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:09:21+00:00 2026-05-11T06:09:21+00:00

I have a Visual Studio setup project that has an Installer class. In the

  • 0

I have a Visual Studio setup project that has an Installer class. In the installer class I set a setting as follows:

MessageBox.Show(Properties.Settings.Default.MySetting);  Properties.Settings.Default.MySetting = 'Foo'; Properties.Settings.Default.Save();  MessageBox.Show(Properties.Settings.Default.MySetting); 

The problem is that even though I know that this code is being executed (I am doing other stuff), the setting is never set!!

The message boxes do suggest that the value is being set, but when I go to the .config file the value is still blank!

Anyone have any ideas why and/or a possible workaround?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T06:09:22+00:00Added an answer on May 11, 2026 at 6:09 am

    What I do for my installers is to use the ‘file’ attribute in App.Config. The appSettings block takes a ‘file’ attribute, like so:

    <appSettings file='user.config'>     <add key='foo' value='some value unchanged by setup'/> </appSettings> 

    The ‘file’ attribute is sort of like CSS, in that the most specific setting wins. If you have ‘foo’ defined in user.config as well as App.config, the value in user.config is used.

    Then, I have a config generator that writes out a second appSettings block to user.config (or whatever you want to call it), using values in a dictionary.

    using System.Collections.Generic; using System.Text; using System.Xml;  namespace Utils {     public class ConfigGenerator     {         public static void WriteExternalAppConfig(string configFilePath, IDictionary<string, string> userConfiguration)         {             using (XmlTextWriter xw = new XmlTextWriter(configFilePath, Encoding.UTF8))             {                 xw.Formatting = Formatting.Indented;                 xw.Indentation = 4;                 xw.WriteStartDocument();                 xw.WriteStartElement('appSettings');                  foreach (KeyValuePair<string, string> pair in userConfiguration)                 {                     xw.WriteStartElement('add');                     xw.WriteAttributeString('key', pair.Key);                     xw.WriteAttributeString('value', pair.Value);                     xw.WriteEndElement();                 }                  xw.WriteEndElement();                 xw.WriteEndDocument();             }         }     } } 

    In your installer, just add something like the following in your Install method:

    string configFilePath = string.Format('{0}{1}User.config', targetDir, Path.DirectorySeparatorChar);  IDictionary<string, string> userConfiguration = new Dictionary<string, string>();  userConfiguration['Server'] = Context.Parameters['Server']; userConfiguration['Port'] = Context.Parameters['Port'];  ConfigGenerator.WriteExternalAppConfig(configFilePath, userConfiguration); 

    We use it for our test, training, and production servers, so all we have to do is specify the machine name and password during the install, and everything’s taken care of for us. It used to be a 3-hour process, including going through multiple config files to set passwords. Now it’s almost entirely automated.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Visual Studio Setup Project that I use to install a fairly
I have created a custom dialog for Visual Studio Setup Project using the steps
I have a setup project created by Visual Studio 2005, and consists of both
I have created a setup project using Visual Studio 2008. After the application is
I have a little dilemma on how to set up my visual studio builds
I have Visual Studio web test attached nicely to a data source, but I
I have Visual Studio 2005 Professional ENU installed and want to create GUIDs using
I have visual studio 2008 installed on my PC. Can anyone tell me what
I have Visual Studio 2008 Professional and I am having issues with expanding and
I have Visual Studio 2008 with SP1 installed and it is crashing when I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.