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 7664675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:21:54+00:00 2026-05-31T14:21:54+00:00

I have a web app that has search functionality. The search algorithm is compiled

  • 0

I have a web 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. Once the search code is compiled, the settings info is incorporated in Search.dll.config which is put in the bin directory along with Search.dll. Now in my web app, I add Search.dll to the references. The config file is not added into the web app. However the web app runs fine and knows where the file is. Because inside Settings.Designer it uses the DefaultSettingValueAttribute to assign a default if the config file is not there.

How do I also add Search.dll.config to my web app so the operator can change the location of the index files on the server as need be?

Thanks

EDIT:

I tried to add the config file to my deployment folder. But ASP.NET puts the dlls in a directory at C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root…… and the config file doesn’t get copied there. So at this point I have no idea how to include the config file with my code.

Thanks for your help.

Note:

I have been using the following code to get the values of the config file into the app. However, it depends on the dll and the config file to be in the same folder, which I do not know how to accomplish.

    var executingAssembly = System.Reflection.Assembly.GetExecutingAssembly();
    var location = executingAssembly.Location; //C:\MyApp\bin\Debug\Search.dll
    var config = ConfigurationManager.OpenExeConfiguration(location);
    var sections = config.Sections; //count of this is 21
    ConfigurationSectionGroup csg = config.GetSectionGroup("applicationSettings");
    ConfigurationSectionCollection csc = csg.Sections;
    ConfigurationSection cs = csc.Get("Search.Properties.Settings");
  • 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. Editorial Team
    Editorial Team
    2026-05-31T14:21:55+00:00Added an answer on May 31, 2026 at 2:21 pm

    Your best bet is to add the config to the web project directly. .NET doesn’t really support configuration associated with a library in the way you are attempting; and this is by design. Other users of your library may need different configuration. Mark the file as being content that should be copied to the output folder.

    EDIT:

    To do this set “Build Action” to “Content” and “Copy to Output Directory” as “Copy if newer” in the file properties. You can discover the file in the bin folder using HttpRuntime.BinDirectory. You may want to pass this location to your library rather than have the library assume it’s running in a web project.

    Alternatively, just embed the config you need in web.config (config files have a facility to break out settings into a separate file as well).

    Finally, you could consider embedding the file as a resource.

    EDIT:

    Looking at the code you are using, just move it into web.config. Much easier, and idiomatic. Once it’s in web.config just use ConfigurationManager.GetSection() to read your section.

    Incidentally, there’s a free configuration section designer that makes creating the classes to support custom configuration sections very easy. Look in the VS Extensions Online Gallery here:

    http://visualstudiogallery.msdn.microsoft.com/2a69f74e-83df-4eb0-8cac-cd83b451cd1d?SRC=VSIDE

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

Sidebar

Related Questions

I have an existing web app that has a data layer and a bll
I have a very simple Mac Cocoa app that just has a Web View
I have a web app that is using ActiveResource to talk to another server
I'm developing a web app using Django, and I'll need to add search functionality
I have a Java web app that I'm developing, using JBoss Seam as the
I have a Django webapp that has both a front-end, web-accessible component and an
I have a web app that is heavily loaded in javascript and css. First
I have a web app that only registered users can use, therefore I should
We have an web app that is talking to Netsuite via Netsuite's web services.
I have a web app that I've recently applied a jQuery ThemeRoller theme to.

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.