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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:30:18+00:00 2026-05-11T03:30:18+00:00

I have a C# class library and a startup project (a console app). The

  • 0

I have a C# class library and a startup project (a console app). The class library includes a service reference to a web service. When I try to run the project, I get an InvalidOperationException because the startup project isn’t reading the class library’s app.config, and it’s ignoring the service reference. To get it working, I’m forced to add the same service reference to the startup project. Is there any way I can avoid this? Can I make the startup project recognize the class library’s service reference and app.config without having to copy it to the startup project?

I’ve tried adding a link to the app.config from the class library, but that doesn’t work. The class library isn’t very portable if it requires anyone who uses it to add that service reference to the startup project.

  • 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-11T03:30:18+00:00Added an answer on May 11, 2026 at 3:30 am

    Think about what you are trying to do – you have two assemblies that you are building:

    Library ConsoleApp 

    Both of these assemblies have configuration files – I would imagine they look something like this:

    Library     app.config ConsoleApp     ConsoleApp.exe.config 

    When you run ConsoleApp it has no way of reading from or knowing aboout app.config from your Library assembly. The only configuration file that it knows or cares about is ConsoleApp.exe.config. Now it is possible to have configuration files reference each other but this is not the proper solution for what you are trying to do.

    Since your Library assembly has no entry point, it will never be loaded into an AppDomain. Since it will never be loaded into an AppDomain its application configuration file will never be used.

    What you ought to do is reference Library in ConsoleApp via a project reference. Then move all the relevant configuration data from app.config into ConsoleApp.exe.config as this is the configuration file that will be used by your application.

    This will allow you to have to two things you need to invoke methods on your web service

    1. The code in Library that can send and receive SOAP messages.
    2. The configuration metadata that is required by Library to function.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 275k
  • Answers 275k
  • 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
  • Editorial Team
    Editorial Team added an answer It mostly depends on what you need to do within… May 13, 2026 at 2:36 pm
  • Editorial Team
    Editorial Team added an answer A simple way to do this is to sum the… May 13, 2026 at 2:36 pm
  • Editorial Team
    Editorial Team added an answer Try this instead: newFriend = new friend( response[0]["@items"][0]._id, response[0]["@items"][0]._nickName, response[0]["@items"][0]._profilePicture,… May 13, 2026 at 2:36 pm

Related Questions

I'm using Visual C++ 2008 SP1. I have an app that is compiled in
I'm exploiting the behavior of the constructors of C++ global variables to run code
I have a C# class library that contains methods that need to be used
I have a C# class library that contains methods that need to be used

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.