1

I've created a new database project to group together all my useful stored procedures and functions so they can be easily deployed to any of my servers.

I'd like to add a couple of CLR UDFs. I tried adding a CLR project to my solution but this wants to be given a specific database to deploy to which is in conflict with the rest of the solution as the point is I want to be able to deploy anywhere!

Am i missing something?!

Sam : )

2 Answers 2

1

The solution was this...

  • Create a SQL Server 2005/2008 Database Project (inluding a new solution)
  • Add a SQL CLR database project to the solution but click cancel when it asks for a database
  • Add a reference to your CLR project from your main database project
  • Uncheck the deployment option on the CLR project

That was it, now when I deploy my database project it includes the CLR functions wherever I choose to deploy it.

Luckily some guy had documented the whole process so go check it out here

Sign up to request clarification or add additional context in comments.

1 Comment

Hi Sam. The link you have given is broken. Can you find it?
0

We added a normal class library to our solution, containing a class with static methods for our UDFs.

eg:

[SqlFunction(IsDeterministic = true, IsPrecise = true)]   
public static bool MyMethod(string x)
{
    ...
}

Then add a reference to this project from the database project.

3 Comments

I've added a normal class library (with clr udf) to my solution and referenced it from the db project, it builds both projects but only deploys one of them, is there something else I need to do to hook them together?!
Have you added the DLL to your database project - Schema Objects\Database Level Objects\Assemblies\yourdll.dll? This should allow it to be deployed as part of the database project.
Cheers Matt, yeh, i had the referencing set up but Visual Studio refused to hook the 2 together complaining of a mismatching signature even though the whole team had double checked it. I ended up finding another solution, thanks for your help : )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.