How can I set application settings at install time (via installer class)

后端 未结 4 1356
终归单人心
终归单人心 2020-12-16 05:34

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.Defa         


        
4条回答
  •  悲哀的现实
    2020-12-16 06:09

    The short answer is that it's not supported in installer classes. You just need to understand that installer class methods are called from msiexec.exe running from the system directory, and that environment can't possibly know that you have a settings file somewhere in a directory that it is completely unaware of. That's why it works with code that explicitly goes to the installed location of the file and updates it there.

提交回复
热议问题