Create a T-SQL format string, something like:
CREATE ASSEMBLY {0}
AUTHORIZATION dbo
FROM 0x{1}
WITH PERMISSION_SET = SAFE
GO
Then, supply this string with arguments to a
Database.ExecuteNonQuery
call, e.g.
database.ExecuteNonQuery(string.Format(
installClrAssemblyFormatString,
clrAssemblyName,
hexFormattedClrAssemblyContents));
To make deployment easier, I included the CLR assemblies as embedded resources of my database management utility (the one responsible for creating the dataase, scripting tables, setting up permissions, etc).
Once the CLR assemblies have been loaded to the database, you still need to have "CREATE PROCEDURE" calls for the various stored procs. I seem to remember snagging this T-SQL from SSMS, but they're not terribly difficult to code by hand.