Visual Studio 2010 Premium是否包括合同工具? [英] Does visual studio 2010 Premium include the contract tools?

查看:88
本文介绍了Visual Studio 2010 Premium是否包括合同工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此功能矩阵 ,Visual Studio 2010 Premium(RC)包含静态代码分析".

According to this feature matrix, Visual Studio 2010 Premium (RC) includes "static code analysis".

但是,在我的方法开始时将调用添加到Contract.Requires似乎没有任何效果.如果违反合同,我不会获得运行时异常.如果无法证明合同,我不会收到编译器警告.我也无法在项目设置中找到代码合同"标签.

However, adding calls to Contract.Requires at the start of my methods doesn't seem to have any effect. I don't get runtime exceptions if the contract is violated. I don't get compiler warnings if a contract cannot be proven. I also can't find a "Code Contracts" tab in the project settings.

我遗漏了一些明显的东西吗?或者此功能仅在Ultimate Edition中可用?

Am I missing something obvious or is this feature only available in the Ultimate edition?

推荐答案

对于代码契约是否包含在VS2010 beta 2附带的框架中,甚至在VS2010本身中,确实存在一些困惑. 代码合同论坛(尤其是

There does indeed seem to be some confusion about whether or not Code Contracts is included in the framework that comes with beta 2 of VS2010, or even in VS2010 itself. The Code Contracts forum (and expecially this post) has several mentions of this with no answers as of yet.

我不认为代码合同属于静态代码分析的标题.我认为静态代码分析是指其他代码分析工具,例如FxCop.

I don't think that Code Contracts falls under the heading of static code analysis. I think static code analysis refers to other code analysis tools like FxCop.

我已经尝试在VS2010 beta 2 Ultimate Edition中使用Contract.Requires,但是我得到的行为与您相同.如果您在代码分析"选项卡下查看项目属性,则可以启用代码分析,但这与代码合同无关.

I have tried using Contract.Requires in VS2010 beta 2 ultimate edition, but I get the same behaviour as you. If you look in the project properties under the Code Analysis tab, you can enable code analysis, but this doesn't relate to Code Contracts.

根据Melitta(来自基类库团队)对连接文章

According to the comment by Melitta (from the Base Class Libraries Team) on the connect article Make data contract static checking available in Professional Edition:

...但是对静态分析工具的限制表示该版本即将发布.通过静态分析工具需要VSTS,它可以使代码分析过程保持一致.

...but the restriction on the static analysis tool stands for this upcoming release. It keeps the code analysis story consistent, in that the static analysis tools require VSTS.

这建议您(必须)具有团队系统版本才能获得代码合同的编译时版本.

This suggests that you (will) have to have the team system version to get the compile-time version of Code Contracts.

这篇关于Visual Studio 2010 Premium是否包括合同工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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