Microsoft Contracts:程序集加载导致元数据导入警告
我正在尝试学习 Microsoft Code Contracts 库,我有以下简单的功能:
internal static Engine CreateBuildEngine(Microsoft.Build.Framework.ILogger logger)
{
Contract.Requires( logger != null );
var engine = new Engine { DefaultToolsVersion = "3.5" };
engine.RegisterLogger(logger);
return engine;
}
当尝试编译它时,合同静态编译器会抛出以下警告消息:
warning : contracts: Assembly load resulted in metadata import 'Could not resolve member reference: Microsoft.Build.BuildEngine.Engine::set_DefaultToolsVersion.'
然后立即放弃(并且不会尝试进行任何进一步的合同处理)。 如果我删除设置 DefaultToolsVersion
的代码,那么合约验证器可以正常工作,但是这是毫无意义的,因为它会导致代码不正确。
我在谷歌上找不到任何提及这一点...有什么方法可以解决这个问题,或者这只是合同库中的一个错误? (诚然,它处于预发布状态)
谢谢
I'm trying to learn my way around the Microsoft Code Contracts libraries, and I have the following simple function:
internal static Engine CreateBuildEngine(Microsoft.Build.Framework.ILogger logger)
{
Contract.Requires( logger != null );
var engine = new Engine { DefaultToolsVersion = "3.5" };
engine.RegisterLogger(logger);
return engine;
}
When attempting to compile this, the contracts static compiler throws up the following warning message:
warning : contracts: Assembly load resulted in metadata import 'Could not resolve member reference: Microsoft.Build.BuildEngine.Engine::set_DefaultToolsVersion.'
and then promptly gives up (and doesn't attempt to do any further contract processing).
If I remove the code which sets DefaultToolsVersion
then the contract verifier works correctly, however this is rather pointless as it will cause the code to be incorrect.
I can't find any mention of this on google... Is there some way that I can fix this, or is it just a bug in the contracts library? (admittedly it's in pre-release status)
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论