0

I have 2 projects in the same solution: One is a windows project and the other one is a console application. They both have 2 app.config in each project.

I am trying to read the values from the .vshost.exe.config from windows application(Project 1) into the Console application (Project 2).

I am finding it difficult to get the path of this config files read into the 2nd project.

Any pointers in achieving this, would be greatly helpful

Ron
  • 1,901
  • 4
  • 19
  • 38

2 Answers2

1

The .NET Framework behavior about config files is one for an assembly per version.

The path is internally managed by the framework in:

UserAppData\Company\[AssemblyName]_Url_[some obfuscated id per version]

If you want to share config, you can create a hand-made application settings file like this:

How to create a hand-made application settings file

How to initialize user app data and document path

For example you can store it in UserAppData\Company\SomeFixedName\ or anything you want.

  • Thanks @Oliver Rogier, will try your steps and the link, to see how to achieve this. – Ron Oct 27 '19 at 17:18
1

Basically I would reconsider you design - settings of particular project should be able for reading only within that project.

E.g. if you need some info (say getting some data from path "xxx" which is stored in #1 Project config file then your #1 Project should have a public API for doing that and #2 Project should only use that API)

If there is still a strong necessity of doing that than you should better create a new project for that or store those configs in database.

fox112358
  • 79
  • 9