How to use relative paths in ReSharper DotSettings layers

We want to share .DotSettings between several solutions. The goal is to have one CodeStyle.DotSettings , which we call the layer in all of our X.sln.Dotsettings . However, I see unexpected behavior when I add a layer.

Go to the "Manage Settings" section, right-click "Solution X team-shared" → "Add Layer" → "Open Settings File", select CodeStyle.DotSettings and click "Open."

Then I check X.sln.Dotsettings and see two links, one of which uses the absolute path, and the other the relative:

<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=3BE2D8150433584697322AAD3C173856/AbsolutePath/@EntryValue">C:\path\to\my\repo\CodeStyle.DotSettings</s:String> <s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=3BE2D8150433584697322AAD3C173856/RelativePath/@EntryValue">..\CodeStyle.DotSettings</s:String>

Checking the absolute path to my local repository does not make sense, so I'm trying to remove this line from X.DotSettings , but it no longer appears in the Layer Settings dialog box. The relative path seems suspicious with its leading points, so I'm trying to remove ..\ from it, but it still doesn't appear in the "Settings Levels".

What am I doing wrong?

We are using ReSharper 8.2.3

+6
source share
2 answers

See the corresponding issue in the JetBrains tracker: RSRP-339002 .

Don't delete anything: ReSharper is trying to download the file from both paths, so you should be fine. I have been using a similar setting (generic and versioned DotSettings between several solutions) for the past two years without any problems.

You cannot delete an absolute path: it is used as a key. You can still vote for the problem. I personally do not like to have an absolute path in a file with a controlled source, even if it does no harm in this case.

As for the extra lead ..\ , I am observing the same behavior. I do not know why; maybe the path refers to the folder with the cache, and not to the folder with the solution? In any case, it is definitely necessary.

+9
source

R # supports both absolute and relative paths to accommodate all scenarios for using file attachment layers. The relative path works for source-driven solutions with an injected layer file also verified in the same source control. An absolute path works to inject a file from an external resource, such as a global path on a machine, or a network resource in the case of a solution with a controlled source.

An absolute path is currently a must. Mostly for historical reasons. This could probably be changed to "requires one."

The relative path refers to the disk file at the host level into which it was entered. In your case, this is a .sln.DotSettings file. Why not a folder, but I missed it when I implemented it! And it did not come up during testing or beta program. For example, it worked for relative paths, and no one bothered to count duplicates so far% -)

+6
source

Source: https://habr.com/ru/post/979497/


All Articles