Can we share some contents of App.config between projects?

前端 未结 5 1401
忘了有多久
忘了有多久 2020-12-10 10:40

I have two independent projects in my Visual Studio 2008 solution. Both has its own App.config. But in one project, I need one or two properties defined in another project\'

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-10 11:05

    Only the "running" app.config is used, but you can go external like marc_s says.

    You can also create a .Settings file that's "shared". Go to the "shared" project properties, the Settings tab on the left, create a setting with Application scope, and set the Access Modifier on top to Public. In your other project you can then use ClassLibrary1.Properties.Settings.Default.SettingName to access it. It will be strongly typed, but you may need it at compile time.

提交回复
热议问题