.NET Config Files configSource outside the application directory folder

前端 未结 10 1529
灰色年华
灰色年华 2020-11-28 05:06

I have two applications one a console application and the other an ASP.NET app. They both need to know the same appSettings and connectionStrings. So ideally I would like to

10条回答
  •  清酒与你
    2020-11-28 05:47

    Another solution is simply to add the configuration file in all your projects as a link instead of actually copying the file to your projects. Then set the "Build Action" of the file to "Content" and "Copy to Output Directory" to "Copy if newer" and when you compile the project you will have the file in the output directory.

    To add the file as a link in the "Add Existing Item" dialog box, there is an Add button with a dropdown. Choose "Add as link" from the dropdown on the Add button to complete the process.

提交回复
热议问题