Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid duplicate app.config using Visual Studio 2008 unit testing?

When I have one app.config in my main project I always have to duplicate it to its test project. How to avoid it?

Update I also asked a very similar, and slightly complicated question

like image 384
Jader Dias Avatar asked Aug 31 '26 21:08

Jader Dias


2 Answers

Add it as a link from a single place. Choose one of the projects as the one with the real app.config and link it to the other projects.

Add -> Existing Item -> Navigate to config file -> add as link (the down arrow in the Add button)

like image 145
Otávio Décio Avatar answered Sep 03 '26 12:09

Otávio Décio


You can always set up the configuration file using a series of smaller configuration files, and then point both application configuration files to these smaller files using the various configSource attributes provided for you in the configuration system. This will allow you to modularize your configuration, as well as create a common location.

appSettings will allow you to add a "file" attribute that will allow you to offload your application settings onto another file completely.

like image 36
David Morton Avatar answered Sep 03 '26 13:09

David Morton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!