I have just started using code contracts to make my preconditions neater and more readable, hoping to get some further benefits like static checking later. However as I committed my code and a build was done it failed on the unit tests (that test my code which uses CC) with the error:
... threw exception: System.Diagnostics.Contracts.ContractException: An assembly (probably "...") must be rewritten using the code contracts binary rewriter (CCRewrite) because it is calling Contract.Requires and the CONTRACTS_FULL symbol is defined. Remove any explicit definitions of the CONTRACTS_FULL symbol from your project and rebuild. CCRewrite can be downloaded from http://ift.tt/1HAe1HE. After the rewriter is installed, it can be enabled in Visual Studio from the project's Properties page on the Code Contracts pane. Ensure that "Perform Runtime Contract Checking" is enabled, which will define CONTRACTS_FULL.
It is a TFS 2010 Build Server, and it has not had anything extra installed for Code Contracts. I installed the CC msi locally and do not have any problem. My CC properties page for the project is set up as follows:
I have googled and it seems many people are complaining that TFS does not have support for CC. I do not currently have admin rights to the build box but I am getting it to try and install the same msi there. Does anyone know what the resolution to this problem is?
Aucun commentaire:
Enregistrer un commentaire