How to create strongly type key in Visual Studio

Following are the simple steps to generate .snk file and strongly type key:

  1. Create any normal project/class library or any existing project
  2. Go to  "All programs >Visual Studio (any version) 2015 > Visual Studio Tools > Developer Command Prompt for Visual Studio right click run as administration
  3. Write command to generate .snk file or "Strong Name Key" i.e. sn -k E:\NameForYourStrongKey.snk
  4. Now goto opened project goto AsseblyInfo.cs double click and add attribute inside the file [assembly: AssemblyKeyFile("E:\\NameForYourStrongKey.snk")]
  5. Now Save and build your project and see the output window and copy the path of generated dll.
  6. Go to same command prompt and paste that path after cd "copied path without dll"
  7. Now use command "sn -T dllName.dll" It will generate Public Key Token
  8. Now to install the assembly in the cache type the use command in the command promt: gacutil –i "Name of the Class Library"
  9. Now the Assembly is successfully installed in your system. If you want to see that you can see that in the location “C:\Windows\Microsoft.NET\assembly\GAC_MSIL and your projectName”







要查看或添加评论,请登录

Sudarshan Rathod的更多文章

社区洞察

其他会员也浏览了