I saw a demo of Code Contracts the other day and decided to give it a shot in a little test project.
I can setup my Code Contracts code appropriately after adding a 'using System.Diagnostics.Contracts' statement to the classes, but the contracts don't seem开发者_运维问答 to be enforced.
Is there a reason why I don't see the 'Code Contracts' tab appearing on the project properties screen?
You need to install the Dev Labs toolkit in order to get the Visual Studio Integration to show up.
Code Contracts are part of .Net 4, but the tooling isn't part of VS 2010 by default.
It can be downloaded from here : http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx
精彩评论