Avoiding source code deployment with CLR projects
One of the things I haven't been keen on is the auto-deployment of source code when deploying an assembly from within a Visual Studio Database project.
Each assembly that is sent to the database ends up with an entry in sys.assemblies.
However, there can be multiple entries in sys.assembly_files for a single assembly. The binary of the assembly is one entry. Visual Studio also deploys the pdb file and the source code as additional files. Many see this as undesirable as it is another copy of the source code that isn't in a source code control system ie: another copy of the source out in the wild.
Note: you need these files deployed to be able to debug against a server. However, that shouldn't be happening on a production server anyway. For example, when you enable debugging on a connection in one of these projects, you are warned that when you hit a breakpoint, *all* managed threads on the server will stop. Think about that very carefully. This means that most developers should be testing/debugging against their own local copy of SQL Server (or SQL Express - yes it supports SQL CLR).
Today, on an email list I participate on, Milind Lee from the product group pointed out that you can avoid this deployment behaviour:
There is a Deploy Code check box in the deployment properties of the project.
Great tip thanks Milind !