You should not deploy anywhere other than development through Visual Studio, so the connection string in Project should always point to your developer's environment.
After you have tested the code on the development server, you can script to build in SSMS by right-clicking on the Assembly in question and making "Script Assembly As ...", then "Create To" ... ", and then" New query window. ”This will give you the base script that should be used for deployment in QA, Staging, and Production.
General format:
USE [DBName] GO CREATE ASSEMBLY [AssemblyName] AUTHORIZATION [dbo] FROM 0x0000... WITH PERMISSION_SET = SAFE
You do not need to distribute assembly files in other environments, but if you want it, it will not hurt.
If you want to automate this as soon as you have this basic script, you can always take the updated assembly code (which is indicated as 0x0000 above) with:
SELECT Content FROM sys.assembly_files WHERE name = 'AssemblyName'
Edit: For the sake of completeness, as Jeremy mentioned in a comment below, the above information describes the deployment of the Assembly itself, and not wrapper objects to access the code inside the Assembly. Complete deployment process:
- Discard existing wrapper objects (stored procedures, functions, triggers, types and aggregates)
- Remove assembly
- Create new assembly
- Creating Shell Objects
source share