␡
- Commenting Your Code
- Guarding Your Code
- Installing the Code Contracts Library
- Using Code Contracts
- Contracts on Interfaces and Abstract Methods
- Suppressing Warnings
- Building Contract Reference Assemblies
- Summary
Like this article? We recommend
Building Contract Reference Assemblies
Building Contract Reference Assemblies
A contract reference assembly enables the contracts in your project to be available to other referencing projects. Without the contract reference assembly, those referencing projects would be unable to determine what contracts are present. The contract reference assembly is named based on the "parent" assembly. That is, for an assembly named Foo.dll, the contract reference assembly will be named Foo.Contracts.dll and will appear in the project output directory.
If you decide to build a contract reference assembly, you have three choices:
- (none). This is the default setting and indicates that you haven't made an explicit choice. If another project requires the contracts defined in this project, you will get a warning that no contract reference assembly was found.
- Build. If your project has contracts, this is the recommended setting and will create the contract reference assembly.
- DoNotBuild. If your project does not contain contracts, or there are problems building the contract reference assembly, you should use this setting.