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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:19:59+00:00 2026-05-10T18:19:59+00:00

I recently wrote a DLL in C# (.Net 2.0) which contains a class that

  • 0

I recently wrote a DLL in C# (.Net 2.0) which contains a class that requires an IP address. A co-worker of mine altered the class to retrieve the IP from a ‘.dll.config’ (XML) file — This apparently is automatically generated by the ‘Application Settings’ file he created (Settings1.settings). The benefit of this was to allow the end-user to change the IP address in the XML/config file at will.

Unfortunately, when I check his code out of the tree and try to compile (or use) this new code, any application calling this DLL only gets the default value, rather than the value from the file.

The constructor that calls the config file looks like this:

    public class form : System.Windows.Forms.Form     {         public form()         {             // This call is required by the Windows Form Designer.             InitializeComponent();             IP = IPAddress.Parse(Settings1.Default.IPAddress);         }     } 

I found a reference to this problem on the MSDN forums where a user said:

the ‘old’ values (the ones you define at development time) are hard coded. If the franework isn’t able to access or open the config file it will use the defaults instead. This will always happen if you use settings in a dll.

  1. Does this mean that I cannot store an external value for a DLL in a config file? (My co-worker has somehow made this work…)

  2. Since my framework appears to be unable to access or open the config file, how do I figure out why it’s failing? Or even detect when this happens?

Decker: That helps a bit. Unfortunately, I am writing this DLL to a specification, so I don’t actually have access to the Application’s config file. As you’ll note above, my co-worker created a ‘Settings1.settings’ file. I didn’t understand this at the time, but it seems now that adding the ‘1’ keeps it out of the settings space of any application that calls it.

I guess what I’m trying to figure out is why the DLL doesn’t seem to find the config file sitting next to it in the same directory. Tracing thru the code step-by-step reveals nothing.

As an aside, I can change the ‘Output Type’ of my assembly from ‘Class Library’ to ‘Windows Application’ and add the following lines at the beginning of my DLL code:

    [STAThread]     public static void Main(string[] args)     {         System.Windows.Forms.Application.Run(new form());     } 

When I run this, it generates a different config file (a ‘.exe.config’) and that one I can alter and have it pull the new data from the file. So I’m a bit confused. Any ideas?

  • 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. 2026-05-10T18:20:00+00:00Added an answer on May 10, 2026 at 6:20 pm

    I’m addressing this exact issue in an application I’m in the midst of prototyping. Although Decker’s suggestion of hacking the config files together should work I think this is a pretty inconvenient manual hack to perform as part of a build cycle. Instead of that I’ve decided that the cleanest solution is to just have each library parse its own library.dll.config file. Its still not perfect and it requires some extra boiler-plate code, but it seems to be the only way to get around the byzantine way that .Net handles these app.config files.

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

Sidebar

Ask A Question

Stats

  • Questions 68k
  • Answers 68k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer [rep pixelsWide] [rep pixelsHigh] May 11, 2026 at 12:21 pm
  • added an answer In Windows, you could create a new file with the… May 11, 2026 at 12:21 pm
  • added an answer I shouldn't think why not - as long as you… May 11, 2026 at 12:20 pm

Related Questions

I recently wrote a parser in Python using Ply (it's a python reimplementation of
I recently wrote a class for an assignment in which I had to store
Having recently discovered this method of development, I'm finding it a rather nice methodology.
I have recently integrated the .NET NLog logging component into one of our applications

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.