How to sign a SQL Server CLR Assembly in Visual Studio 2015

Jeffrey Yao, 2017-02-22 (first published: 2017-02-21)

It took me quite a while to figure out how to sign a SQL Server CLR Assembly (like a CLR stored procedure / function / trigger etc) in VS 2015.

If you google “sign a SQL Server CLR Assembly”, you will most likely find out content published 5+ years ago when people are using Visual Studio 2010/2012. You will likely to see some instructions like

You can go to Project>project properties> “Signing” tab

With a snapshot screen like the following

image

Fig 1

But such snapshot simply does not exist in VS 2015.

If you check MSDN about signing an assembly in Visual Studio as documented here, you will have no clue either.

“You sign an application or component by using the Signing tab of the project properties window (right-click the project node in the Solution Explorer and select Properties, or type project properties in the Quick Launch window, or press ALT+ ENTER inside the Solution Explorer window). Select the Signing tab, then select the Sign the assembly check box.”

because in a SQL Server project created in VS 2015,  a project property window will be like the following

image

Fig 2

The “signing” button is actually in the [SQLCLR] tab as shown below

image

Fig 3

So the basic procedure to sign a SQL Server Assembly with strong name key file is:

1. In VS 2015, solution explorer, right click the project name, choose [properties], or in the menu [Project] click [xxx Properties], where xxx is the project name.

2. Fig2 widow will popup, click [SQLCLR] tab, and Fig3 will show up, click [Signing..] button, Fig 4 window will pop up

image

Fig 4

3. click the check box of [Sign the assembly], and then click <New…> in the drop-down list as shown below (of course, if you already have a key file, then you click <Browse…> )

image

4. Fig 5 window will pop up, and you can input the necessary info to generate a key file

image

Fig 5

5. Then click OK, and again click OK to close Fig5 and Fig 4, and then in [File] menu, click [Save All].

You are done to finish signing a SQL Server CLR assembly.

Rate

Share

Share

Rate

Related content

Database Mirroring FAQ: Can a 2008 SQL instance be used as the witness for a 2005 database mirroring setup?

Question: Can a 2008 SQL instance be used as the witness for a 2005 database mirroring setup? This question was sent to me via email. My reply follows. Can a 2008 SQL instance be used as the witness for a 2005 database mirroring setup? Databases to be mirrored are currently running on 2005 SQL instances but will be upgraded to 2008 SQL in the near future.

Robert Davis

2009-02-23

1,567 reads

Networking – Part 4

You may want to read Part 1 , Part 2 , and Part 3 before continuing. This time around I’d like to talk about social networking. We’ll start with social networking. Facebook, MySpace, and Twitter are all good examples of using technology to let…

Andy Warren

2009-02-17

1,530 reads

Speaking at Community Events – More Thoughts

Last week I posted Speaking at Community Events – Time to Raise the Bar?, a first cut at talking about to what degree we should require experience for speakers at events like SQLSaturday as well as when it might be appropriate to add additional focus/limitations on the presentations that are accepted. I’ve got a few more thoughts on the topic this week, and I look forward to your comments.

Andy Warren

2009-02-13

360 reads