Optional use of Code Contracts without changes to project file?

คำถาม Optional use of Code Contracts without changes to project file?

  • Tuesday, December 04, 2012 6:34 AM
     
     

    Hi 

    I have an open source library project VS2010/C# I started using Code Contracts on recently. I want to set it up in a way that is most 'painless' for someone trying to build the code but not have the Code Contracts VS download installed. On the other hand I want extensive checking when it is installed (like on the machine I develop it on).

    Is there a way to optionally use Code Contracts without burdening those without it installed - preferably without changing the project file?

    Strange thing is, I've tried to build the project on my other machine and it gave a "must use rewriter" assertion/exception at runtime. To my knowledge I had no code contracts installed there...

    Thanx,
    Marc


    Marc Jacobi

All Replies

  • Wednesday, December 05, 2012 9:06 AM
     
     

    Hello,

    If you're using the generic version of Contract.Requires I think that you have no other choice but installing it.

    You can read about it here.


    Regards,

    Eyal Shilony