Replacing .ini files used for Access applications which I migrate to .Net C#
Posted on 2014-08-27
I have a number of Access VBA apps to migrate to C#. My Access apps have to be able without software changes to access data either in a prod environment or in a test environment, both being on separate SQL Server DBs on separate Windows servers. To achieve that I use an .ini (text) file which they look for when they are starting and which tell them which DB to access (the ini file contains entries for DB type, name, server and DSN name). Currently I have one central ini file for each environment, and I use 2 sets of shared network directories, one for prod, one for test, with the ini files in the corresponding root directories of each environment. So the apps look for the ini file first in their own directory, and if finding none, go up the directory tree until they find the central ini file, read it, and relink all their tables to the appropriate DB.
What would be the recommended way to achieve a similar result with C# apps ? I've heard about config files but know nothing about them, really. WHat I want to avoid is to have to duplicate the apps.
Thanks for your input