While System.Diagnostics.Contracts is included within the .Net Framework. To use Code Contracts you must install the Visual Studio extensions.

Under Extensions and Updates search for Code Contracts then install the Code Contracts Tools

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b7a0600a-76c0-414e-afba-892336bdd64b/Untitled.png

After the tools are installed you must enable Code Contracts within your Project solution. At the minimum you probably want to enable the Static Checking (check after build). If you are implementing a library that will be used by other solutions you may want to consider also enabling Runtime Checking.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/738c27ee-5f0b-4aa1-8b88-2da048544cb9/Untitled.png