how to add strong name key to our application help me friends
Regards
Srinivas.N
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mayur GujrathiPosted Jun 3, 2011, 5:33 AM
Sandeep ShekhawatPosted Jun 3, 2011, 3:08 AM
Visual Studio 2008 makes it easy to create a strong name key file:
Ø Select your assembly project in the Visual Studio Solution Explorer.
Ø Click the Properties button. The project properties will appear in the main window.
Select the Signing tabØ Check the Sign the assembly checkbox.
Ø In the Choose a strong name key file drop-down, select New. The "Create Strong Name Key" dialog appears:
Ø .In the Key file name text box, type the desired key name. Typically this is the name of your assembly but can be anything. Visual Studio will automatically append the proper file extension.
Ø If desired, you can protect the strong name key file with a password. To do so, check the Protect my key file with a password checkbox, then enter and confirm the password.
Ø Click the OK button.
Now when you compile your project, Visual Studio will automatically sign your assembly with the new strong name key you have just created.
Jiteendra SampathiraoPosted Jun 3, 2011, 3:00 AM
1. Right Click on the application
2. You can see Signing tab option-->Click on it and Tick the Sign in assembly CheckBox
3. Choose New option in Drop Downlist
4. Enter Key File name, password and Confirm password and Click OK.
5. You can see the Stong key file with .pfx Extension.
6. Click on the show all files and under the bin you can find DLL
(your application name is xyz, then you can see the dll name as xyz.dll)
Mayur GujrathiPosted Jun 3, 2011, 2:53 AM
We have a tool named strong name utility to do this, which is a command line tool and should be used from a command prompt as following.
Sn -k
E.g.:
The above atatement generates a key value and writes it into "key.snk".
We can use sn or snk for the extension of key files.
Creating A shared assembly
Step 1: Generate a key file. Open a VS command prompt. Go into your folder and generate a key file as:
Step 2: create a project and associate a key file to it before compilation so that the generated assembly will be strong named.
Open a new project of type class library and name it sAssembly; under class1 write the following:
Public string sayhello()
{
Return "hello from shared assembly";
}
To associate a key file we generated with the project, open the project properties and select the "signing" tab on the LHS which displays a CheckBox as "sign the assembly" select it that displays ComboBox below it from it select browse and select key.snk from its physical location then compile the project using build which will generate assembly Assembly.dll that is strong named.
Step 3: copying the assembly into GAC
.Net provides a command line utility to be used as shown in the following:
Gacutil -I | -u
Open a VS command prompt; go to the location where the Assembly.dll is present and write the following:
Step 4: Testing
Open a new project add a reference to Assembly.dll and write the following code for the button click event.
sAssembly.Classs1 obj=new sAssembly.Class1();
Messagebox.Show(obj.sayhello());
Run the project and verify under the bin/debug folder of the current project where we will not find a copy of the Assembly.dll as it is a shared assembly.
for more details refer this
http://www.c-sharpcorner.com/UploadFile/5eae74/6740/?ArticleID=ab6e516e-773a-4ca9-b5f7-c41abf5d2498