connectionStrings configSource in App.config not working

前端 未结 2 448
有刺的猬
有刺的猬 2020-12-05 22:52

I\'m trying to separate my connection string from my App.config, and as you can\'t do transformations like with Web.config, I thought may I could u

2条回答
  •  离开以前
    2020-12-05 23:12

    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.

    Right Click on file and then Click properties

    Change to "Copy always" or "Copy if newer"

提交回复
热议问题