简体   繁体   中英

Is it possible to have a Resharper settings file 'inherit' from another settings file?

We have a variety of Visual Studio 2008 and Visual Studio 2012 solutions in our team. VS08 is being used for legacy reasons, mainly because Smart Device projects are unsupported beyond that version of VS.

We are currently using a single Resharper .DotSettings file and sharing it across every VS2012 solution via a layer in the Team Shared Solution Settings for each solution. This works wonders at the moment, though we would like to also use the "same" settings on our VS08 solutions.

The catch here is that there is a very small subset of rules that were created specifically for .Net4 projects in this common .DotSettings file, and those should not be visible to the .Net2 VS08 projects. For instance, there is a custom rule in it that suggests converting argument validation code with exceptions to Contract.Requires<TException> calls.

Ideally there should be a way to make a 'base' settings file, which would be used across every VS08 solution, and an 'inherited' settings, containing every setting in the base file plus the additional rules specific to the VS12 solutions. Updating the base file should also make every solution using the inherited file to update that setting.

Is there a way to properly handle this while avoiding multiple clones of the same file and at the same time keeping the capability of autoupdating every solution's settings upon editing one of the settings files?

I think that creating two files (one with the general settings and another with only the .Net4 additions) could work. In that case, both files would be included as layers on every VS12 solution, but only the former on the VS08 solutions. I'm not sure this is the best approach in this case though, and would like to hear other possible options, as we would prefer to keep only one layer set on every solution, since this seems more easily maintainable.

We're using the latest version of Resharper, currently v7.1.1000.900.

You can create a settings file that overrides some of the settings from the main settings file. Here is how to do it:

  1. Make sure that all your main settings are in a custom settings file and all settings layers above it are empty.
  2. Create an empty file for additional settings and put it above the main settings file.
  3. Now both settings files should be under the team-shared layer, one above the other, in the Setting Layers dialog box .
  4. Open a solution and make sure that the settings from the main settings file apply.
  5. Make necessary modifications to the settings and save them to the additional settings file using Save To .

To better understand how settings layers work, check out this post .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM