Reading connection string from external config file

前端 未结 4 767
一整个雨季
一整个雨季 2020-12-17 16:46

I have created a console application and an app.config file and Connections.config file. The app.config file has a connectionstring property source pointing to the Connectio

4条回答
  •  借酒劲吻你
    2020-12-17 16:54

    MSDN says:

    Do not include any additional elements, sections, or attributes.

    You need to remove the XML encoding.

    Edit

    Also, you need to set the properties of your config file to Copy to Output Directory = Copy if newer or Copy always.

    enter image description here

    Edit 2

    To build on what Dave said, you add the clear element to your external file. Your final Connections.config file should look exactly like this:

    
      
      
    
    

提交回复
热议问题