[英]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. 我们团队中有各种Visual Studio 2008和Visual Studio 2012解决方案。 VS08 is being used for legacy reasons, mainly because Smart Device projects are unsupported beyond that version of VS.
VS08由于遗留原因而被使用,主要是因为除了该版本的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. 我们目前正在使用单个Resharper .DotSettings文件,并通过每个解决方案的团队共享解决方案设置中的一个层在每个VS2012解决方案中共享它。 This works wonders at the moment, though we would like to also use the "same" settings on our VS08 solutions.
虽然我们想在VS08解决方案上使用“相同”的设置,但这在目前仍然有效。
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. 这里的问题是,在这个常见的.DotSettings文件中专门为.Net4项目创建了一小部分规则,而这些规则不应该对.Net2 VS08项目可见。 For instance, there is a custom rule in it that suggests converting argument validation code with exceptions to
Contract.Requires<TException>
calls. 例如,其中有一个自定义规则建议将参数验证代码转换为
Contract.Requires<TException>
调用的异常。
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. 理想情况下,应该有一种方法可以创建一个“基础”设置文件,该文件将用于每个VS08解决方案,以及一个“继承”设置,包含基本文件中的每个设置以及特定于VS12解决方案的其他规则。 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. 我认为创建两个文件(一个具有常规设置,另一个仅添加.Net4)可以正常工作。 In that case, both files would be included as layers on every VS12 solution, but only the former on the VS08 solutions.
在这种情况下,两个文件都将作为层包含在每个VS12解决方案中,但只包括VS08解决方案中的前者。 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. 我们使用的是最新版本的Resharper,目前为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:
这是怎么做的:
To better understand how settings layers work, check out this post . 要更好地了解设置图层的工作方式,请查看此文章 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.