Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

Shared config across multiple projects within same solution #223

Closed
kspearrin opened this issue Jun 12, 2015 · 2 comments
Closed

Shared config across multiple projects within same solution #223

kspearrin opened this issue Jun 12, 2015 · 2 comments

Comments

@kspearrin
Copy link

Using beta-4 I can add a config file to my project like so:

var configuration = new Configuration()
    .AddJsonFile("config.json");

If I have multiple projects within a solution that share the same config settings, I have to create a config.json for each project with the same settings in it.

What if I want to share settings in a single "global" config file across multiple projects within the same solution?

My solution directory structure looks like this:

/my_solution
  /prj1
    prj1.xproj
    config.json
  /prj2
    prj2.xproj
    config.json
  my_solution.sln

Could I move config.json out to the solution level and still add it somehow?

/my_solution
  /prj1
    prj1.xproj
  /prj2
    prj2.xproj
  my_solution.sln
  config.json

or maybe even

/my_solution
  /prj1
    prj1.xproj
    config.json
  /prj2
    prj2.xproj
    config.json
  my_solution.sln
  global_config.json

It looks to me like paths are always resolved starting at the application base.

How would I do this? Does this make sense to do?

@dougbu
Copy link
Member

dougbu commented Jun 12, 2015

@kspearrin you have at least two options: Include "../" in the relative path you pass to AddJsonFile() or pass the absolute path to that method.

Quick reminder the APIs here have changed in Beta 5 and more recent dev builds (if you are on the bleeding edge): See aspnet/Announcements#13, aspnet/Announcements#14, and aspnet/Announcements#25 for more information.

@kspearrin
Copy link
Author

Wonderful! Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants