Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to register a shared assembly ?

Answer Posted / pandian

To work with .Net commands directly in Command prompt, we
have to set the path as below:

1) Right Click on ?My Computer? and go to ?Properties?
in the Context Menu.
2) In the system properties, go to Advanced Tab
3) Click on the Button ?Environment Variables?. In the
System Variables, double click Path and a popup with Edit
System Variables will appear. In the variable value:
include the path as below:
;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program
Files\Microsoft Visual Studio 8\SDK\v2.0\Bin

The above paths where the .net tools (sn.exe, gacutil.dll)
all are found.


To generate Strong Name Key:

Example:

1) Create an folder GACKey in C:
2) Open Command Prompt.
3) Create SN key as below
4) C:\>sn ?k SampleKey.snk
5) Now if the key was successfully generated, then
command like ?key pair written to SampleKey.snk? will be
displayed.
6) You can find the key in C:\GACKey\SampleKey.snk

Create an assembly:

1) Open Class file in a project
2) Include some methods like below:

public string HelloWorld()
{
return "Hello World";
}
3) Before Class, after importing namespaces, include
the following assembly info:
using System.Reflection;
[assembly: AssemblyKeyFile("C:\\GACKey\\SampleKey.snk")]
[assembly: AssemblyVersion("1.0.0")]
4) Build the application as Ctrl+ Shift + B
5) Dll for the assembly will be created
as ?App_Code.gb4sj5sd.dll? as the assembly is placed in
App_Code
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\exassembly\59f52ba2\a8d76ba5

To Install Assembly in GAC using GAC Util component:

1) Open command prompt
2) Type the following command:
3) C:\>gacutil -
I ?C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\exassembly\59f52ba2\a8d76ba5
\App_Code.gb4sj5sd.dll?
4) The above after gacutil ?I is the path where
assembly dll is created.


Register assembly entry in registry:

1. Click Start - run, then type regedit to open registry;
2. Go to
HEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\Assembly
Folders\;
3. Right click AssemblyFolders, then select new to
create a new key for your assembly(for example:
MyTestAssembly);
4. Select Modify by right clicking Default, then enter
the location where your dll resides.

Ex: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\exassembly\59f52ba2\a8d76ba5

5. Restart the VS.NET application. (Ctrl + Shift + F5)

6. Add project reference and in .NET Tab reference list,
you will see the assembly (App_Code.gb4sj5sd i.e.dll name)
added to GAC.

7. Create instance to the class in assembly and can access
its methods.

Is This Answer Correct ?    9 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can we call methods in remoting asynchronously?

913


How do you implement distributed applications in .net?

919


Can you explain remoting?

968


What are the types of remotable objects?

942


Explain the difference between the registerwellknownservicetype(), registerwellknownclienttype(), registeractivatedservicetype() and registeractivatedclienttype() in .net?

899


What are the situations you will use singleton architecture in remoting ?

904


What are static assemblies and dynamic assemblies. Differences between them?

1080


What is a formatter in .net remoting?

999


Which Namespaces is used to achieve the Remoting?

965


Explain the types of .net remoting?

1038


About Iunknown interface Queue ,its methods Query Interface Addref,Release and Explain each ?

2927


What are the steps to publish an object outside the service domain

890


Hello, I want to connect a system in LAN and i want to access that.When ever i am moving a mouse in my desktop the similar thing have to happend in the another system in which i have connected. I need coding for this in c# and .NET . any one please help me.It is very urgent to me Advance thanks. my email id:manojkumarchallagundla@gmail.com

2649


What are the ways to configure remoting objects before client can use them?

1045


Garbage collector?s functionality on unmanaged code ?

3495