views:

155

answers:

1

Hi,

I want put all configuration data from WPF projects to one file for whole solution. E.g. service references, etc.

How can I read this data in every single project instead default app.config file?

Thanks for any help. Kamilos

+2  A: 

I do this with my AssemblyInfo.cs files:

  1. Create a new folder in your solution (not in any project)
  2. Add your common app.config file to this directory
  3. Edit it
  4. Go to each project you wish to share this file
  5. Right click the project root, select Add existing item
  6. Browse and select the common app.config
  7. On the Add button, click that little dropdown off to the right side and select Add as Link
  8. Profit.
Will
Good idea but service references not working properly :|
Kamilos
@kam, make absolutely sure your reference was correct to begin with. Could be lots of reasons why. An exception is always relevant. Might it have to do with one project not referencing another, and therefore services defined in one won't be resolvable in the other, thus causing errors when WCF attempts to configure itself? You can split apart configuration files, as well. Search around MSDN for that. You can put the assembly-specific stuff in the split config files and the common stuff in the shared file.
Will
Ok, it finaly works after manual del old lines from csproj file ( :| ) It works only with default name app.config and before adding link original app.config must be removed and cleared in csproj
Kamilos