简体   繁体   English

如何将dotcover排除文件设置添加到TFS?

[英]How can one add the dotcover exclude file settings to the TFS?

I'm trying to add the "exclude file" settings (for jetbrains-dotcover) that I make to the TFS in order to avoid co programmers having to set the same settings manually. 我试图将我进行的“排除文件”设置(用于jetbrains-dotcover)添加到TFS中,以避免共同程序员不得不手动设置相同的设置。

After trying around and searching I didn't find any info there and thus my question is: Is this possible to do? 在尝试并搜索之后,我在那里没有找到任何信息,因此我的问题是:这可能吗? And if so how? 如果是这样怎么办?

I am presuming that you are running dotCover from the command line in TFS. 我假设您正在TFS的命令行中运行dotCover。 With reference to the documentation on running DotCover from the command line you need to add a parameter to your call to exclude the assemblies: 参考从命令行运行DotCover的文档 ,您需要在调用中添加参数以排除程序集:

/Filters=ARG : (Optional) Specify coverage filters using following syntax: +:module= ;class= ;function= ; / Filters = ARG :(可选)使用以下语法指定coverage过滤器:+:module = ; class = ; function = ; Use -:myassembly to exclude an assembly from code coverage. 使用-:myassembly从代码覆盖率中排除程序集。 Asterisk wildcard ( ) is supported here 这里支持星号通配符(

If you have a dotCover xml file for your coverage settings you can put the exclusion into it. 如果您的coverage设置具有dotCover xml文件,则可以将排除项放入其中。 See the same documentation for editing the xml. 请参阅相同的文档来编辑xml。 I imagine the bit you need to add would look something like this: 我想您需要添加的位看起来像这样:

<Filters>
  <ExcludeFilters>
    <FilterEntry>
      <ModuleMask>AssemblyToExclude.dll</ModuleMask>
      <ModuleMask>*Tests*</ModuleMask> <!--This is an example to exclude all assemblies with Tests in their name-->
    </FilterEntry>
  </ExcludeFilters>
</Filters>

There is some general info in the documentation on how to set up running from the command line. 文档中有一些有关如何设置从命令行运行的常规信息。

*Proviso: I haven't tried what I have suggested, I am merely projecting from my own DotCover/TeamCIty TFS experience. * Proviso:我没有尝试过我所建议的内容,我只是根据自己的DotCover / TeamCIty TFS经验进行投影。 More information may provide a more accurate answer. 更多信息可能会提供更准确的答案。

Update: 更新:
If you are using dotCover as per @Thomas comment, then you can edit the filters for you machine by running dotCover and selecting File=>Edit Coverage Filters... If you add a filter there it will also apply to any coverage run from Visual Studio. 如果按@Thomas注释使用dotCover,则可以通过运行dotCover并选择File => Edit Coverage Filters ...来为您的计算机编辑过滤器。如果在此添加过滤器,它将也适用于从Visual Studio运行的任何Coverage。工作室。 For example adding an assembly *Test* exclude filter will stop any assembly with the word Test in from being included in the reports: 例如,添加程序集* Test * exclude过滤器将阻止在报告中包含单词Test in的任何程序集:

覆盖过滤器

I would think that your team would need to have the same exclusion filters setup on all their machines. 我认为您的团队需要在所有计算机上设置相同的排除过滤器。

Update2: UPDATE2:
I found where the per solution filter settings are stored. 我发现每个解决方案过滤器设置存储在哪里。 They are in your DotSettings file next to your sln (eg MyProject.sln has MyProject.sln.DotSettings). 它们位于sln旁边的DotSettings文件中(例如MyProject.sln具有MyProject.sln.DotSettings)。 In order to get the exclusion into this file you should in Visual studio with your solution open go to DotCover->Edit Coverage Filters and Add a Filter for the current solution. 为了将此文件排除在外,您应该在Visual Studio中打开解决方案,然后转到DotCover-> Edit Coverage Filters并为当前解决方案添加一个过滤器。

添加解决方案过滤器

This yields the following info in your DotSettings file: 这会在您的DotSettings文件中产生以下信息:

<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters&gt;&lt;Filter ModuleMask="*Maths*" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /&gt;&lt;/ExcludeFilters&gt;&lt;/data&gt;</s:String>

If you commit the DotSettings file to TFS your team will get the exclusions. 如果将DotSettings文件提交到TFS,您的团队将获得排除。 See the docs about sharing your settings here and the docs and about setting them up here . 请参阅有关在此处共享设置的文档,以及有关在此处进行设置的文档。

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

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