Testing a Private Assembly

Lets start to create a client application for privateassembly, Open a notepad and write following code [till now you have not created any client application using visual studio, you will do the same very soon in ASP.Net section]. For this example lets create a client application using Console application from templates pane [windows applications are beyond the scope of the book].

  • In Solution explorer change the class name from Program to mathClassClient
  • Using private assembly.

  • Add CSharp.AStepAhead.privateAssembly namespace
  • Now, important step is to add assembly reference, right click on the project
    in solution explorer and click on the Add Reference
    [you can choose the
    same from Project menu]
  • Adding Assembly Reference

  • Create an object of mathClass Class
  • Build the project or press F5
  • Important Important:Version information of an assembly is stored in its MANIFEST
    : Concept of Versioning is applicable only to GAC [Global Assembly Cache], because
    private assemblies are lying in their individual folders.

  • Output of Client application :
  • Output:Client Application
    Important Important:
    1. Revise source of above project [privateAssembly project] to
    understand the code. In this project, you saw that there is nothing extraordinary
    operations, just accepting integer values and on the behalf of these values result
    will retaining by overriding ToString() method. Yes, you can override this virtual
    method as per your requirement, as done in this example.
    2. Now, in Client application, this is a Console Based application
    project, as you are going for Asp.Net so, Windows applications are beyond the
    scope of the book
    .

Leave A Reply