抑制 Microsoft Fakes 警告 [英] Suppressing Microsoft Fakes warnings

查看:38
本文介绍了抑制 Microsoft Fakes 警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Microsoft Fakes 来填充几个 WindowsAzure 组件以进行测试.按照 vs 2012: Shims compile 中的建议,我更新了我的 .fakes 文件以生成我实际需要的垫片:

I'm using Microsoft Fakes to shim a couple WindowsAzure components for testing. Following the advice in vs 2012: Shims compile, I updated my .fakes file to just generate the shims I actually need:

<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/" Diagnostic="false">
  <Assembly Name="Microsoft.WindowsAzure.Storage" Version="2.1.0.0"/>
  <StubGeneration>
    <Clear/>
  </StubGeneration>
  <ShimGeneration>
    <Clear/>
    <Add FullName="Microsoft.WindowsAzure.Storage.CloudStorageAccount"/>
    <Add FullName="Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient"/>
    <Add FullName="Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer"/>
    <Add FullName="Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob"/>
    <Add FullName="Microsoft.WindowsAzure.Storage.Queue.CloudQueueClient"/>
    <Add FullName="Microsoft.WindowsAzure.Storage.Queue.CloudQueue"/>
  </ShimGeneration>
</Fakes>

但我仍然收到无法生成某些假货..."警告.正在生成所有指定的垫片,并且注释上述任何行都会导致我的测试项目无法构建.如果我打开诊断,我会看到几十条消息,例如:

But I'm still getting the "Some fakes could not be generated..." warning. All the specified shims are being generated, and commenting any of those above lines out causes my test project to fail to build. If I turn on diagnostics, I see dozens of messages like:

Warning 2   Cannot generate shim for Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient+<>c__DisplayClass1: type is not supported because of internal limitations.

一切正常,我只是想取消警告,以免混淆我们的 CI 服务器.是否有非诊断消息的警告编号,我可以将其粘贴在测试项目中以忽略?

Everything works, I just want to suppress the warning so it stops confusing our CI server. Is there a warning number for the non-diagnostic message I can just stick in the test project to ignore?

推荐答案

您可以使用

<Remove TypeName="c__DisplayClass" />

这将删除包含上述字符串的所有类型.

That will remove out all the types containing the above string.

请参阅 msdn 链接

这篇关于抑制 Microsoft Fakes 警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆