Monday, May 21, 2012

MSDEPLOY Install CLR Assembly into SQL server

I'm writing my first MSDEPLOY package to deploy our website. It uses an SQL CLR .DLL which needs to be installed into the database as part of deployment.



This is nominally very simple. I just need to deploy the DLL onto the destination server and then execute an SQL Command to have it add the assembly. When the SQL command is executed it must be given the path to the assembly to add to the SQL Server.



Their are two choices out of the box. One is to use the runCommand provider to execute a command script to install it. The other is to add an SQL script using the Package/Publish SQL tab in Visual Studio 2010.



What I can't determine after much searching is how to pass the deployment path of the DLL to either the command script or the SQL or the Package/Publish SQL.



I could declare a new parameter in the parameters.xml file and force the user to provide the installation path in a seperate parameter and then use parameterEntry to write the update to the SQL script. However it seems a little odd to have to provide information to MSDEPLOY that it already knows.



Having scripts know where the deployed resources were actually deployed seems like a fundamentally basic concern that I wonder if there is something really basic that I've missed.





No comments:

Post a Comment