How to generate SQL CLR stored procedure installation script w/o Visual Studio <p>I am working on CLR stored procedure using VS2010. I need to generate standalone deployment script to install this procedure at customer servers. Now I am using Visual Studio which generate such script when I press F5 and try to debug SP on DB server. This script is placed at <code>bin\Debug\MyStoredProcedure.sql</code> file. It looks like this:</p> <pre><code>USE [$(DatabaseName)] GO IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE id=OBJECT_ID('tempdb..#tmpErrors')) DROP TABLE #tmpErrors GO CREATE TABLE #tmpErrors (Error int) GO SET XACT_ABORT ON GO SET TRANSACTION ISOLATION LEVEL READ COMMITTED GO BEGIN TRANSACTION GO PRINT N'Dropping [dbo].[spMyStoredProcedure]...'; GO DROP PROCEDURE [dbo].[spMyStoredProcedure]; GO IF @@ERROR &lt;&gt; 0 AND @@TRANCOUNT &gt; 0 BEGIN ROLLBACK; END IF @@TRANCOUNT = 0 BEGIN INSERT INTO #tmpErrors (Error) VALUES (1); BEGIN TRANSACTION; END GO PRINT N'Dropping [MyStoredProcedure]...'; GO DROP ASSEMBLY [MyStoredProcedure]; GO IF @@ERROR &lt;&gt; 0 AND @@TRANCOUNT &gt; 0 BEGIN ROLLBACK; END IF @@TRANCOUNT = 0 BEGIN INSERT INTO #tmpErrors (Error) VALUES (1); BEGIN TRANSACTION; END GO PRINT N'Creating [MyStoredProcedure]...'; GO CREATE ASSEMBLY [MyStoredProcedure] AUTHORIZATION [dbo] -- here should be long hex string with assembly binary FROM 0x4D5A90000300000004000000FFFCD21546869732070726F6772616D...000000000000000000 WITH PERMISSION_SET = SAFE; GO IF @@ERROR &lt;&gt; 0 AND @@TRANCOUNT &gt; 0 BEGIN ROLLBACK; END IF @@TRANCOUNT = 0 BEGIN INSERT INTO #tmpErrors (Error) VALUES (1); BEGIN TRANSACTION; END GO PRINT N'Creating [dbo].[spMyStoredProcedure]...'; GO CREATE PROCEDURE [dbo].[spMyStoredProcedure] @reference UNIQUEIDENTIFIER, @results INT OUTPUT, @errormessage NVARCHAR (4000) OUTPUT AS EXTERNAL NAME [MyStoredProcedure].[MyCompany.MyProduct.MyStoredProcedureClass].[MyStoredProcedureMethod] GO IF @@ERROR &lt;&gt; 0 AND @@TRANCOUNT &gt; 0 BEGIN ROLLBACK; END IF @@TRANCOUNT = 0 BEGIN INSERT INTO #tmpErrors (Error) VALUES (1); BEGIN TRANSACTION; END GO IF EXISTS (SELECT * FROM #tmpErrors) ROLLBACK TRANSACTION GO IF @@TRANCOUNT&gt;0 BEGIN PRINT N'The transacted portion of the database update succeeded.' COMMIT TRANSACTION END ELSE PRINT N'The transacted portion of the database update failed.' GO DROP TABLE #tmpErrors GO </code></pre> <p>I am wondering, is it possible to generate such script without Visual Studio? For example, what if I build solution with MSBuild and then generate this script with some tool? I believe, that if I read assembly as byte array and then serialize it to hex string and insert into script template - it could work, but maybe there is some easier standard solution?</p> <p>Thanks.</p>