Downloadable Assemblies

This technique may be helpfull for createing destributed applications or application that needs to be updateable through LAN or internet. What do you need to know:

  • What is strong name
  • What is assembly
  • How to use command line (cmd.exe)
  • How to use csc compiler
  • Hot to configure application, What is config file
  • What is IIS
Steps:
  • Create strong named assembly
  • Compile it
  • Place at your server
  • Create Solution that will use this assembly
  • Create Config file for your solution with the following contents
     
    How to:
     1. Create strong named assembly
    
       a. Generate the key (cmd command): sn -k key.snk 
       b. Put following lines in your assembly source code:
  using System;
  using System.Reflection;
  ....

  
  [assembly:AssemblyKeyFile(@"PATH\key.snk")]
  [assembly:AssemblyVersion("1.0.0.0")]
               

  ....
  namespace My
  {

   
     
<?xml version="1.0" encoding="utf-8" ?>

<configuration>



 <runtime>

   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

     <dependentAssembly>

       <assemblyIdentity name="lib"

                         publicKeyToken="0adfbaad3776a0d3"

                         culture="neutral" />



       <codeBase version="1.0.0.0" href="http://localhost/asm/lib.dll"/>     

     </dependentAssembly>

   </assemblyBinding>

 </runtime>





</configuration>




No comments:

Post a Comment