Use of layers with per project settings?

Following these guides I have been able to setup a DotSettings file that only applies to a specific project:

https://blog.jetbrains.com/dotnet/2012/01/18/per-project-settings-or-how-to-have-different-naming-styles-for-my-test-project/

https://www.jetbrains.com/help/resharper/Sharing_Configuration_Options.html

Similarly to the original example I want to be able to apply different rules to my unit test projects. So far I have only been able to make this work by duplicating the rules across each new project DotSettings file. I would like to be able to have a single unit test settings file that each unit test project just references. This use case is normally supported in Resharper with layers (at least for solution wide DotSettings files). I haven't found any information on if injected layer references are supported in project specific setting files or not.

I have tried copying across the relevant "Default/Environment/InjectedLayers/FileInjectedLayer/" from a working solution file to a project file but haven't been able to get it to work. The structure of the solution wide and project wide settings files look very similar, both are WPF resource dictionaries so it seems plausible that it could work. The syntax of the InjectedLayer keys isn't very obvious, so I may have just done something wrong. Does anyone know if this is supported or if there is another way to get the same result?

2 comments
Comment actions Permalink

Settings layers are mostly broken, they don't work in practice. Just for example, if a setting is changed in a layer, you can't override it in a new layer to the default value: a default value isn't written to the settings file, so if an upper layer has that changed setting it always appies..

 

I changed (not to long ago) to use editor config files: https://www.jetbrains.com/help/resharper/2020.2/Using_EditorConfig.html

 

- They are (somewhat) user friendly - simple key value entries.

- They have layers as in: an editor config file in an inner directory overrides values in an upper directory.

- I have a "global" editor config file in the "root project" directory - it applies to all projects/solutions in that directory.

- There's a menu option somewhere in resharper to edit the editor config settings.

 

Note: I chose to export ALL the settings to the editor config file and a lot of trash 

0
Comment actions Permalink

Hello Owen,

Thank you for the question. The scenario is supported in general. Could you share your *.csproj.DotSettings file and the injected layer DotSettings file? You can attach them to a support request created with the "Submit a Request" button above.

0

Please sign in to leave a comment.