Sharing Visual Studio 2005 Settings.settings File across Assemblies

A new feature of the Visual Studio 2005 is the introduction of the Setting.settings file, which generates a class that maps your application configuration file. This avoids creating this class by yourself, and it supports updating and saving. What is is more interesting is that WebServices automatically add their WSDL locations in there, as well as data connection strings.

There is a problem though when you let VS2005 create the file by itself in a multi-assembly setup, where it creates a settings.settings for a "dll" packaged assembly. You end up with one settings.settings file for each of your assemblies, which is particularily not useful.

So, because there's a solution, you just have to share the only settings.setting file that matters to your application and here's how :

  • Remove the settings.settings file from all your assemblies, except the one that will be the master.
  • Add the master settings.settings file as a linked file in each of your projects, and you're done.

Just in case you've never linked a file in VS, when you're about to add the file to your project, just click on the little arrow next to the open button and select Link File. The magic after this is that VS2005 uses the linked file as if it were a local file.

One last note : Don't forget to copy all your existing settings from each assemblies to your master settings file.

Publié lundi 25 juillet 2005 21:12 par jay
Ce post vous a plu ? Ajoutez le dans vos favoris pour ne pas perdre de temps à le retrouver le jour où vous en aurez besoin :

Commentaires


Les 10 derniers blogs postés

- [WPF] Nouvel article sur c2i.fr par Richard Clark le il y a 2 heures et 5 minutes

- F# nouvelle CTP 1.9.6.2 (update) par Pierrick's Blog le il y a 6 heures et 10 minutes

- La suite ...Proposition de collaboration rédactionnelle entre les communautés de développeurs et Microsoft France par LucasR le 09-05-2008, 17:45

- [Fun] Votre simulateur de vol avec Microsoft ESP par Julien Chable le 09-05-2008, 12:02

- [Best Practices] Customisation du My Site : Comment le modifier en amont et en aval par The Mit's Blog le 09-05-2008, 10:47

- Patrick Tisseghem s'en est allé ... par The Mit's Blog le 09-05-2008, 10:04

- MS AutoCollage par alex# le 09-05-2008, 09:18

- Un grand SharePointeur nous a quitte : Patrick Tisseghem manquera à la communauté ! par RedoBlog - The .NET Gentleman !!! le 09-05-2008, 08:52

- [WPF] Comment charger dynamiquement un fichier XAML qui définit des eventhandler ? par Thomas Lebrun le 09-04-2008, 10:56

- Article sur le filtrage des modèles de site SharePoint par The Grib's Lair [Sébastien PICAMELOT - MVP SharePoint] le 09-04-2008, 00:11