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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:37:42+00:00 2026-05-11T10:37:42+00:00

I have a solution with multiple projects. In each project I’ve added a .config

  • 0

I have a solution with multiple projects. In each project I’ve added a .config file with settings that affect the local settings.

When I tried to read the settings for the database connection, I got some values which I don’t know where they come from.

This is the .config file of DatabaseLayer Solution:

<configuration> <configSections> </configSections> <connectionStrings>     <add name='localDBConnection'         connectionString='Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Niko\Documents\Visual Studio 2008\Projects\GaitLinkServer\DatabaseLayer\GaitLinkDB.mdf;Integrated Security=True;User Instance=True'         providerName='System.Data.SqlClient' /> </connectionStrings> 

When I executed the line

private string connectionString = ConfigurationManager.ConnectionStrings['localDBConnection'].ToString(); 

I’ve got the null reference object exception. So I tried to execute the following command:

ConfigurationManager.ConnectionStrings[0] 

and it returned

{data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true} base {System.Configuration.ConfigurationElement}: {data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true} ConnectionString: 'data source=.\\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true' Name: 'LocalSqlServer' ProviderName: 'System.Data.SqlClient' 

Which don’t know where does it come from.

I would really appreciate if anyone could show how to make a global .config file for a solution with multiple projects and how to link local (Project) .config files.

Thanks!

  • 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-11T10:37:43+00:00Added an answer on May 11, 2026 at 10:37 am

    As a note, if you use ApplicationSettings, the properties get defaults from whatever App.Config file was part of that particular project. You can specify the Application Settings in the running application, which will override the defaults.

    To explain..

    I have a project called CatalogData. Using the Project properties screen / Settings tab, I added a property called test, with value of test.

    The Application Configuration file contains

    <?xml version='1.0' encoding='utf-8' ?> <configuration> 

    …

    <configSections>     <sectionGroup name='userSettings'       type='System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'      >         <section name='CatalogModel.Properties.Settings'          type='System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'           allowExeDefinition='MachineToLocalUser' requirePermission='false' />     </sectionGroup> </configSections>  <userSettings>     <CatalogModel.Properties.Settings>         <setting name='test' serializeAs='String'>             <value>test</value>         </setting>     </CatalogModel.Properties.Settings> </userSettings> 

    …

    </configuration> 

    The code generated to read the setting (make it available via My.Settings.test for VB.NET or as follows in C#

    CatalogModel.Properties.Settings s = new CatalogModel.Properties.Settings(); string test = s.test; 

    Gets defaulted in the generated code, which effectively makes the app.config file unnecessary for deployment so long as the compiled settings are OK.

    In this snippet, you can see the attribute which gives the default, which is compiled.

    ...     [global::System.Configuration.DefaultSettingValueAttribute('test')]      public string test {         get {             return ((string)(this['test']));         }     } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 80k
  • Answers 80k
  • 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 I would separate the address resolution from the UdpClient. Use… May 11, 2026 at 4:23 pm
  • Editorial Team
    Editorial Team added an answer This isn't recursive, but I think it does what you… May 11, 2026 at 4:23 pm
  • Editorial Team
    Editorial Team added an answer There's a FANTASTIC new way to do this in C#… May 11, 2026 at 4:23 pm

Related Questions

I have a solution with multiple projects. In each project I've added a .config
What is the best VS solution setup for DotNetNuke 4.8 inter-module communication development? I
I have a solution with 10 or so projects in it, and have started
First, I know about this: How would you organize a Subversion repository for in
I develop a variety of applications and have 3-4 miscellaneous libraries that I reuse

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.