0

I have an app that has search functionality. The search algorithm is compiled to a separate dll. In the C# code for the search algorithm, I am using strings held in a settings file to point to the directory where the search index resides. But once the search code is compiled, the settings file is somehow incorporated in the dll. I want to have multiple versions of this code running on my server with each pointing to a different location for the index. And I want the operator to change a file to have each version point to something else as they find necessary. Both config files and settings files end up getting incorporated in the dll. How do I then accomplish this? What is the right industry standard way of doing this?

Barka
  • 8,764
  • 15
  • 64
  • 91

1 Answers1

1

It's strange that the settings file is compiled... are you sure about that? Setting, config and resx files should be copied to the output directory, it's even a property you can modify on solution explorer. Then you should get it's values by doing

System.Configuration.ConfigurationManager.AppSettings.Get("YourKey")

But I think this won't know about user changes until app is restarted. If you want settings to be dynamic you should either store them on a database, or on a file that you open, read and close every time you need it.

Hope this helped!

Alejandro B.
  • 4,807
  • 2
  • 33
  • 61
  • I can restart the app. That is not a problem. Either it is compiled or I don't know where it puts the file. Where would it be output to? Thanks! – Barka Mar 17 '12 at 23:37
  • The output file "should" be the bin folder, when compiling. – Alejandro B. Mar 17 '12 at 23:41
  • 1
    I didd some more digging and rephrased the whole question here: http://stackoverflow.com/questions/9762938/moving-the-config-files-for-a-dll-to-the-app-that-calls-the-dll. Thanks for your input. You helped me in the right direction. – Barka Mar 18 '12 at 22:38