Sunday, February 19, 2012

Deploy .NET Assembly with UDFs to a particular SCHEMA

Is it possible to deploy .NET assemblies and the UDF functions therein from Visual Studio.NET into a particular schema?Unfortunately this is not possible through Visual Studio 2005. You would need to write your own script for doing this.
However, you can execute any SQL script during the post deploy process in your SQL Server project as:

1. Write your script into a file called postdeployscript.sql:

2. Add the file to your project by right clicking your project in Solution Explorer and Add à Existing Item.

Make sure you add this in the root of the project and not in the Test Scripts. When you click deploy, Visual Studio will automatically run this scripts after the deployment of your project.
Same holds for predeployscript.sql if you want to execute a script on the SQL server before deployment.

These scripts can be used to automate something that Visual Studio does not currently support.

Thanks,
-Vineet.

|||

Idea postdeployscript.sql and predeployscript.sql are the things I dreamed about all the time Smile. You should definitely include them into default template of SQL Server Project, because I was searching for this solution for two months until I found this post. I asked similar question on the TechNet and the answer was just "you cannot do it".

No comments:

Post a Comment