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

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.

Advertisements
This entry was posted in SQL Development. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s