I have a project that reads in a file based on the value in the C # installation class. This value, however, varies from machine to machine, and Id rather does not prompt the user at the first start of the program as his corporate environment, instead Id, how should it be installed in the installer, but where is the file? Is there an easier way?
This is a visual addin studio, not a standalone program.
From your message, it looks like you have a Windows application ?, you can save the initial value in the application configuration, you can do the installer in Visual Studio and write special actions that can write the values to a file the first time you install in the installation project.
A configuration file is the easiest way to do what you ask, but it is NOT the best. In fact, it is recommended that you do not use .config files for such cases.
whenever users install an “update”, there is a risk of overwriting their existing changes.
Some companies may have policy restrictions for .config files.
the user cannot easily move his settings from one PC to another.
XML, MS-Access, , .config.
, ( .settings)?
- ( ). , xml, XmlSerializer, ( , # , , , .settings).
, , ? , FirstStartup ( true), , , false. " ".
FirstStartup
true
false
- . , , .
App.config. xml , MyApplication.exe.config , . , . :
App.config
MyApplication.exe.config
<configuration> <appSettings> <add key="MySetting" value="My Value"/> </appSettings> </configuration>
:
String setting = ConfigurationSettings.AppSettings["MySetting"];
, . , , , , .
INI XML, .
. , .
, - ini , .
, . . , .
web.config app.config. XML , : http://www.picnet.com.au/blogs/Guido/post/2009/09/10/XML-Settings-Files-No-more-webconfig.aspx
" " ( , " ", , " ", " " ).
Win7 (, , ) :
C:\Users\[ ]\AppData\Local
AssemblyInfo , "AssemblyCompany" ( ) , , , build, , , ( ".config" ).
C:\Users\[ ]\AppData\Local\[company_name]\Application.exe_StrongName_zx0v1qxyoass4d0z3mtwe3vbrhaehkjg\0.0.5812.21662\user.config
, (dll), app.config. 4 (, URL, , ). , → → . → Settings.Default.title,... ..
: , 5 ( , MyProject.MyClass) , , . , xml. ?