views:

120

answers:

2

If code contracts are used in an application then do we need to install anything (from Code Contracts package) on production server like putting assemblies into GAC or running code contracts installation package on production server?

Or just putting libraries in bin folder will work?

A: 

It should be enough to put them in the bin/ folder.

Did something like this a few weeks ago, i'd downloaded a trial for a charting engine, put the .dlls in my lib folder and added a reference to them in my web-project.

We used to use the "Publish" option in Visual Studio when we deployed a website so we got a nice, clean build to upload (now we have a build-server).

This all worked perfectly until we decided to buy the component, I installed it, and added all the assemblies we're moved/installed to the GAC. I took the assemblies and put them in our lib folder and re-added the references.

Everything we're working fine until we decided to publish an update to the project with the new chart-engine assemblies. The site stopped working! :(

After a short time of debugging we found that the error was the new .dlls for the chart-engines weren't outputed to the bin folder since they were in the GAC. But when we published to our server they're aren't there, so to fix the problem we just copied them over and everything worked like a charm again.

Kenny Eliasson
A: 

From the Code Contracts site linked in your question:

Contracts act as checked documentation of your external and internal APIs. The contracts are used to improve testing via runtime checking, enable static contract verification, and documentation generation.

Correct me if I'm wrong, but I think that code contracts are designed as a development-time aid only. Therefore, it is supposed that you will disable them when you compile the asemblies intended for deployment/production.

Konamiman