.net 如何在多个解决方案之间共享相同的 Resharper 设置,而无需人工干预?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14896096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to share the same Resharper settings between multiple solutions, with no manual intervention?
提问by julealgon
Our projects are organized in a master solution (containing every project) and multiple smaller solutions containing groupings of related projects.
我们的项目组织在一个主解决方案(包含每个项目)和多个包含相关项目分组的较小解决方案中。
I would like to share the same Resharper settings across every solution, making sure that the developers don't ever need to import configuration files in Resharper or do anything manually for that matter. The version we are using is one of the latest ones, 7.0.1. The DotSettings file checked in in TFS works great on a single solution, but replicating the same file for 20-30 solutions is a no-no.
我想在每个解决方案中共享相同的 Resharper 设置,确保开发人员永远不需要在 Resharper 中导入配置文件或为此手动执行任何操作。我们使用的版本是最新版本之一,7.0.1。在 TFS 中签入的 DotSettings 文件在单个解决方案上效果很好,但为 20-30 个解决方案复制相同的文件是不行的。
Is there a way to share the same configuration with every project/solution in the whole team, without the need for the developers to configure this explicitly? Ideally, it should be possible to change the path to the .DotSettings file for each solution so that when a single .DotSettings file is edited it automatically affects every solution in the team.
有没有一种方法可以与整个团队中的每个项目/解决方案共享相同的配置,而无需开发人员明确配置?理想情况下,应该可以为每个解决方案更改 .DotSettings 文件的路径,以便在编辑单个 .DotSettings 文件时它会自动影响团队中的每个解决方案。
Update:
更新:
I have searched a bit about this and tried 2 different methods, but none of them work 100%:
我对此进行了一些搜索并尝试了 2 种不同的方法,但没有一种方法可以 100% 有效:
- Hardlinksusing the mklink toolwork perfectly locally, but TFS does not support them
- Normal shortcuts would also be a reasonable solution to this, but Resharper doesn't read them
I'm out of options here.
我在这里别无选择。
Update 2:
更新 2:
The solution proposed by Daniel Hilgarth works perfectly, but only if Resharper is updated. A bug that caused the .DotSettings files to be auto checked out and edited on every machine was corrected on the 7.1 release. I have tested this before and after updating the software and it now works as I expected.
Daniel Hilgarth 提出的解决方案可以完美运行,但前提是 Resharper 已更新。导致 .DotSettings 文件在每台机器上自动检出和编辑的错误已在 7.1 版本中得到纠正。我在更新软件之前和之后都对此进行了测试,现在它可以按我的预期工作。
More information about the bug can be found here:
可以在此处找到有关该错误的更多信息:
采纳答案by Daniel Hilgarth
Resharper supports option layering.
Resharper 支持选项分层。
You would use it like this:
你会像这样使用它:
- Have one DotSettings file with all your settings in it.
- For each solution perform these steps:
- ReSharper -> Manage Options
- Right-click "Solution 'Your Solution' team-shared"
- Select Add Layer -> Open Settings File
- Choose the central DotSettings file
- 拥有一个包含所有设置的 DotSettings 文件。
- 对于每个解决方案,请执行以下步骤:
- ReSharper -> 管理选项
- 右键单击“解决方案‘您的解决方案’团队共享”
- 选择添加图层 -> 打开设置文件
- 选择中央 DotSettings 文件
This would create a DotSettings file for each solution. You need to check these into TFS along with the central DotSettings file.
Important: The DotSettings file of the solutions only contain a link to the central one, they don't replicate the settings.
这将为每个解决方案创建一个 DotSettings 文件。您需要将这些与中央 DotSettings 文件一起检入 TFS。
重要提示:解决方案的 DotSettings 文件仅包含指向中央文件的链接,它们不会复制设置。
回答by Anton Sizikov
The question is old, but if someone is still looking for the way to share team settings:
问题很老,但如果有人仍在寻找共享团队设置的方式:
All the settings for R# can be exported and packed as a NuGet packageand distributed as a regular ReSharper extension.
R# 的所有设置都可以导出并打包为 NuGet 包,并作为常规 ReSharper 扩展分发。
This gives you a flexibility: you can share different settings for different teams, ReSharper will take care of detecting the new version and notifying the developer. Well, basically all the benefits that you can get when using the NuGet.
这为您提供了灵活性:您可以为不同的团队共享不同的设置,ReSharper 将负责检测新版本并通知开发人员。嗯,基本上是使用 NuGet 时可以获得的所有好处。
回答by Matas Vaitkevicius
In Resharper 2015
在 Resharper 2015
Go to Resharper-> Options-> Manage(pic 1) -> Options-> Import and Export(pic 2) -> from file....
去Resharper-> Options-> Manage(图 1) -> Options-> Import and Export(图 2) ->from file....
And if you what to import it for your team you can to Solution settingsthen instead of Import and Exportin Optionsgo to Copy Settings to-> team-shared.
如果你有什么导入它为您的团队你可以Solution settings再而不是Import and Export在Options转到Copy Settings to- > team-shared。
Hope this saves you some time.
希望这可以为您节省一些时间。


