connectionStrings configSource in App.config not working

只愿长相守 提交于 2019-11-27 21:46:22

If you added the file yourself, the build action (in the file properties) may not have been set correctly.

The Copy to Output Directory option needs to be Copy if newer or Copy Always to ensure that the .config file ends up in the bin directory, otherwise it will not be there and trying to load the configuration will fail.

I had the same issue and Oded solution works for me. But I will just precise that to find out how to change the file "Copy to Output Directory option" to be "copy if newer or copy always", you have to

  • rigth click on the file
  • select properties
  • go to advance
  • then will see copy to output directory and choise copy if newer or copy always

This helped me, I hope it will help you too

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!