Home > other >  VS2022 solution with 2 web apis; running the 2nd uses appsettings of the 1st one
VS2022 solution with 2 web apis; running the 2nd uses appsettings of the 1st one

Time:12-12

So, as titled, I've created a solution with 2 web api projects inside (quite simple) I have configured the appsettings for each project, set the 2nd one as startup project When I run the 2nd one in swagger, i've noticed my settings of the 2nd one are not taken into account and that it takes the settings from the 1st one Any idea ? Thanks for your kind help

I've tried changing projects settings and startup configuration but found no useful solution except moving the project to another solution

CodePudding user response:

If you right click on the appsetting.json, and then select properties, there is a property called "Copy to output directory". Be sure you have it as "Copy always".

What could happen probably is the thing, that you made changes to both, but because it didn't include, it seems like it is using the one from the first one.

Hope this is your case.

  • Related