简体   繁体   English

链接StyleCop设置文件

[英]Linking StyleCop settings files

I have two settings files in my project. 我的项目中有两个设置文件。 One lies next to the Visual Studio solution file. 一个位于Visual Studio解决方案文件旁边。 The other one is in an subfolder which is used for export to other products we develop. 另一个位于子文件夹中,该子文件夹用于出口到我们开发的其他产品。

  • ... ...
  • solution.sln 解决方案
  • settings.stylecop (linked to the other settings file) settings.stylecop (链接到其他设置文件)
  • Export (folder) 导出(文件夹)
    • settings.stylecop (<= used for export, no merging) settings.stylecop (<=用于导出,不合并)
    • stylecop.targets stylecop.targets
    • stylecop.dll stylecop.dll
    • etc... 等等...

When I link the sln settings file to the one in the export folder StyleCop has all rules activated. 当我将sln设置文件链接到导出文件夹中的一个文件时,StyleCop会激活所有规则。 It seems that the linking is ignored. 似乎链接被忽略了。 But when I open the sln settings file in the editor it seems that the setting are inherited. 但是,当我在编辑器中打开sln设置文件时,该设置似乎已被继承。

What have I made wrong? 我做错了什么? Now I have to manually ensure that both files are always identical. 现在,我必须手动确保两个文件始终相同。

It sounds like your LinkedSettingsFile value is incorrect. 听起来您的LinkedSettingsFile值不正确。 To make sure that its value is treated as being relative to the settings file (and not the working directory of the executing process) it must start with a period. 为了确保将其值视为相对于设置文件(而不是相对于执行进程的工作目录)的值,它必须以句点开头。 For example: 例如:

<StyleCopSettings Version="105">
  <GlobalSettings>
    <StringProperty Name="MergeSettingsFiles">Linked</StringProperty>
    <StringProperty Name="LinkedSettingsFile">.\SomeFolder\Settings.StyleCop</StringProperty>
  </GlobalSettings>
</StyleCopSettings>

There is some more information in this CodePlex issue . CodePlex问题中有更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM