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

  • Home
  • SEARCH
  • 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 589991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:28:54+00:00 2026-05-13T15:28:54+00:00

I have made a .NET class library in C# that initializes some logging, sent

  • 0

I have made a .NET class library in C# that initializes some logging, sent to an external tool. The library is altogether separate from any application, but in order to initialize it, I need to make at least one method call to it.

Is there a way for me to put something into app.config that will auto-load that dll, and call something in it? I can change the contents to suit whatever, I don’t need to support any own class name or method name or whatnot.

Note, I need this to be done without any changes to the application in question, save for changing the app.config file.

Is this possible? If so, what should I be looking at?

  • 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-13T15:28:54+00:00Added an answer on May 13, 2026 at 3:28 pm

    This had me puzzled for a while on how to do it. I originally thought it could be achieved by creating a custom WebProxy that would configure the logging, and loading it into the main application using the defaultProxy configuration element. This however suffer from the same problem as the other configuration suggestions in that the code is only run when required (in this case when a HTTP request is used) – thus requiring a change to the original application.

    I have achieved it though by reversing the approach. Instead of trying to get the original application to configure the logging, you could write a stub of an application that configures the logging and then launches the original application.

    As an example:

    I have a WinForms application called Forms.exe whose entry point is defined as:

    [STAThread]
    internal static void Main()
    {
        Application.Run(new MainForm());
    }
    

    In my stub application (which I have as a console application), I configure the logging and then load and run Forms.exe:

    internal static void Main()
    {
        ConfigureLogging()
        Assembly app = Assembly.LoadFrom(@".\Forms.exe");
        app.EntryPoint.Invoke(null, null);
    }
    

    This uses reflection to load the other application into the one that configures the logging.

    Caveats:

    • the other application has to be a .Net application in order to load it this way
    • you might need to use Reflector to inspect the other application to work out the correct arguments to pass to the entry point (ie. if it takes string[] args, you might need to pass in an empty string[] instead of a null as the arguments)
    • the original application ‘s console window will hang around while the other application runs (this is probably not a problem, but if it is you could try hiding it using FreeConsole)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need to html encode the strings in order to… May 13, 2026 at 7:40 pm
  • Editorial Team
    Editorial Team added an answer The stop words are just common words in the English… May 13, 2026 at 7:40 pm
  • Editorial Team
    Editorial Team added an answer There is nothing wrong with the cast to int -… May 13, 2026 at 7:40 pm

Related Questions

I am the CTO and sole developer for my company. I'm getting ready to
I actually have two questions regarding the same problem but I think it is
In my webapplication (C#, .Net 3.5), made up of a core class library (containing
This article describes a way, in C#, to allow the addition of arbitrary value
In my Java development I have had great benefit from the Jad/JadClipse decompiler. It

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.