如何从代码覆盖率中排除 MVC Razor 视图?
我想排除MVC视图 - IE,cshtml
具有C#代码的文件 - 从代码ADO中的覆盖范围报告。
我尝试过的是:
添加
[uble fromcodecoverage]
属性属性到cshtml
。在
*。视图
runsettings
文件中添加排除范围:< modulepath>。*视图。*</ modulepath>
两项工作。有什么方法可以实现这一目标吗?
I want to exclude MVC views—i.e., cshtml
files, which have C# code—from code the coverage report in ADO.
What I have tried is:
Adding the
[ExcludeFromCodeCoverage]
attribute to thecshtml
.Adding exclusion for the
*.Views
assembly in therunsettings
file:<ModulePath>.*Views.*</ ModulePath>
Neither worked. Is there any way of achieving this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一旦我能够识别
runsettings
文件(https://learn.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?msclkid=14b6671abb6811ec9283acde13b7ff4e&view=vs-2022#specify -a-run-settings-file-in-the-ide),我能够使用它来排除正在预编译的视图:Once I was able to get the
runsettings
file recognized (https://learn.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?msclkid=14b6671abb6811ec9283acde13b7ff4e&view=vs-2022#specify-a-run-settings-file-in-the-ide), I was able to use this to exclude views that were being pre-compiled: