Assembly

Development Team Montego Data Limited
September 2013
Summary:This article () uses switchable css files

Contents

Introduction
How Do I Create Shared Assemblies?
How Do I Create a Unique Assembly Name?
How Do I Sign My DLL/EXE?
How Do I Place the Assembly in a Shared Cache?
Hands On
Conclusion

Introduction

When you create a private assembly, an assembly is installed in a subdirectory of the application,
so even if two assemblies have the same name there is no problem because an application will always refer to its own assembly.
Now, consider the case when you develop a shared assembly.
In this case, it is important to know how assemblies are versioned. All assemblies have a version number in this form:

major.minor.build.revision
If you change the original assembly, the changed version will be considered compatible with the existing one if the major and minor versions of both the assemblies match.
When the client application requests an assembly, the requested version number is matched against available versions and the version matching the major and minor version numbers and having the latest build and revision numbers are supplied.

How Do I Create Shared Assemblies?

The following steps are involved in creating shared assemblies:
  1. Create your DLL/EXE source code.
  2. Generate a unique assembly name using SN utility.
  3. Sign your DLL/EXE with the private key by modifying the Assembly Info file.
  4. Compile your DLL/EXE.
  5. Place the resultant DLL/EXE in a global assembly cache by using the AL.exe utility.

How Do I Create a Unique Assembly Name?

Microsoft now uses a public-private key pair to uniquely identify an assembly.
These keys are generated by using a utility called SN.exe (SN stands for shared name).
The most common syntax of it is:
sn -k mykeyfile.key
where k represents that you want to generate a key and the file name following is the file in which the keys will be stored.

How Do I Sign My DLL/EXE?

Before placing the assembly into a shared cache, you need to sign it by using the keys you just generated.
You mention the signing information in a special file called AssemblyInfo.
Open the file from JS.NET or VS.NET or CS.NET Solution Explorer and change it to include the following line:
[assembly:AssemblyKeyFile("file_path")]
Now, recompile the project and the assembly will be signed for you.
Note: You also can supply the key file information during a command line compilation via the /a.keyfile switch.

How Do I Place the Assembly in a Shared Cache?

Microsoft has provided a utility called AL.exe to actually place your assembly in shared cache:
AL /i:my_dll.dll
Now, the utility will place your DLL at the proper location.

Hands On

Now that you understand the basics of assemblies, you can apply your knowledge by developing a simple shared assembly.
In this example, you will create a C#.NET component called SampleGAC (GAC stands for Global Assembly Cache).
You also will create a key file named sample.key.
You will sign your component with this key file and place it in the Global Assembly Cache.
Here is the code for the component. It just includes one method that returns a string.
using System;
namespace BAJComponents
{
   public class Sample
   {
      public string GetData()
      {
         return "hello world";
      }
   }
}
Step 1: Generate a key file
To generate the key file, issue the following command at the command prompt.
sn -k sample.key
This will generate the key file in the same folder.
Step 2: Sign your component with the key
Now, you will sign the assembly with the key file you just created.
csc sampleGAC.cs /t:library  /a.keyfile:sample.key
Step 3: Host the signed assembly in the Global Assembly Cache
You will use the AL utility to place the assembly in the Global Assembly Cache:
AL /i:sampleGAC.dll
After hosting, the assembly just goes to the WINNT\Assembly folder and you will find your assembly listed there.
Note how the assembly folder is treated differently than normal folders.
Step 4: Test that your assembly works
Now, create a sample client application that uses your shared assembly. Just create a sample code as listed below:
using System;
using BAJComponents;
public class SampleTest
{
   static void main()
   {
      sample x= new sample();
      string s= x.getdata();
      console.writeline(s);
   }
}
Compile the above code by using:
csc sampletest.cs /t:exe /r:<assembly_dll_path_here>

Conclusion

Now, copy the resulting EXE in any other folder and run it. It will display "Hello World", indicating that it is using your shared assembly.

[h1]

text

[h2]

text

[h3]

text

[h4]

text
<h1>Inside Table,row,td This is [h1]</h1>

Look At FontSize of [h1]

<h2>Inside Table,row,td This is [h2]</h2>

Look At FontSize of [h2]

<h3>Inside Table,row,td This is [h3]</h3>

Look At FontSize of [h3]

<h4>Inside Table,row,td This is [h4]</h4>

Look At FontSize of [h4]

This page has tried to load JavaScript Files, read a cookie write to this document a css style sheet and Call a JavaScript Function to render the header. Further down the page is another document write and Call a JavaScript Function to render the footer.
When you allow the ActiveX Content, you see this as column of information (top left).
When you do not allow the ActiveX Content, you see this as column of information under Conclusion (bottom).
This current Open <td> is closed by the line in the file
<script type="text/javascript"></script></td>
When JavaScript runs the other column claims 80% the syntax for this is
<script type="text/javascript">
document.write("<td width=\""+(self==top?80:99)+"%\">");
</script> 
When the page is run with scripting the <TD></TD> pair exist.
Some form of Rendering Side Effect, hopefully without scripting the first </td> fails and that matches the missing <td>
Maybe the missing <td> is captured inside the missing <table></table> by the Microsoft Internet Explorer
This current column when it appears (top left) is more than 20% due to the inclusion of <pre></pre>.
Directory of
c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin
19/03/2010 14:02
69,440 al.exe
1 File(s) 69,440 bytes Directory of c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools 19/03/2010 08:02
81,216 al.exe
1 File(s) 81,216 bytes Directory of c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64 19/03/2010 08:02
91,456 al.exe
1 File(s) 91,456 bytes Directory of c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64 19/03/2010 14:02
86,336 al.exe
1 File(s) 86,336 bytes Total Files Listed: 4 File(s) 328,448 bytes

Wilmott Online Technical Forum For Derivative Experts