Programmatically create custom settings layer

At our company, we are exploring options for creating R# settings for the whole team to share.  In terms of the R# settings layer, we are thinking this ends up being ABOVE machine-wide settings, but BELOW solution-layer settings.  We all work on many different projects throughout a year, and so want the consistency to span beyond a solution.  

Started by creating a settings file that would overwrite each user's machine-wide settings (...JetBrains\Shared\vAny\GlobalSettingsStorage.DotSettings) but it's looking like there are some settings that we don't want to nuke by replacing that file (choice for intellisense, etc)

We think the best approach here is to create a custom layer above the machine-wide settings.  Optimally, we'd like to do this programmatically - we have a tool we run on new dev boxes that get it all configured.

Any thoughts on the best way to do this programmatically?  I have looked at the settings file after adding some custom layers.  It's XML so in theory I can just change it, but there are some "magic values" in that file.  

for example:

<s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=C4794B44CC1EAA44B1F95B64748B229A/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=C4794B44CC1EAA44B1F95B64748B229A/AbsolutePath/@EntryValue">D:\Temp\Resharper-TeamCustom-CSharp.DotSettings</s:String>

 

 

0
1 comment

Here, we have a nuGet package that adds 3 Solution-Layer files: a base settings file that comes from the package, a settings file above that, which just has file layout settings (to make our layouts how StyleCop likes them), and then the top-most Solution-Layer file is "Solution Specific Settings.dotsettings", which is not overwritten by the nuGet package when updated, unlike the first two files.

Our <SolutionName>.sln.DotSettings file contains:

<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
 <s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=6D0B07A26574534CA0935662A0E3BBF7/@KeyIndexDefined">True</s:Boolean>
 <s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=6D0B07A26574534CA0935662A0E3BBF7/RelativePath/@EntryValue">..\Solution Specific Settings.DotSettings</s:String>
 <s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=94BBD1797681BC4AA74118EFBED241B0/@KeyIndexDefined">True</s:Boolean>
 <s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=94BBD1797681BC4AA74118EFBED241B0/RelativePath/@EntryValue">..\Our Team.DotSettings</s:String>
 <s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=E27D187ED658654C871BC89F28D13AA5/@KeyIndexDefined">True</s:Boolean>
 <s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=E27D187ED658654C871BC89F28D13AA5/RelativePath/@EntryValue">..\StyleCop Layout.DotSettings</s:String>
 <s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File6D0B07A26574534CA0935662A0E3BBF7/@KeyIndexDefined">True</s:Boolean>
 <s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File6D0B07A26574534CA0935662A0E3BBF7/RelativePriority/@EntryValue">1</s:Double>
 <s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File94BBD1797681BC4AA74118EFBED241B0/@KeyIndexDefined">True</s:Boolean>
 <s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File94BBD1797681BC4AA74118EFBED241B0/RelativePriority/@EntryValue">2</s:Double>
 <s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=FileE27D187ED658654C871BC89F28D13AA5/@KeyIndexDefined">True</s:Boolean>
 <s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=FileE27D187ED658654C871BC89F28D13AA5/RelativePriority/@EntryValue">3</s:Double></wpf:ResourceDictionary>

The long GUIDy numbers seem to just need to match in a file.

0

Please sign in to leave a comment.