C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




how can i create assempbly?


Posted Date: 04 Sep 2008      Total Responses: 4

Posted By: kiran       Member Level: Silver     Points: 1



dear friends..
i have one dll, so how can i create assembly and how can i diploy dll to assembly.. and how can i use those.. with example.. and can i dump all dlls to assembly..?
thanks in advance
kiran





Responses

Author: Priya    04 Sep 2008Member Level: SilverRating:     Points: 2

I have not done this before.

The following link may help you get started.
http://www.dnzone.com/ShowDetail.asp?NewsId=698

They have given step by step instructions for creating assemlies.

Good luck.



Author: D.Jeya kumar(JK)    04 Sep 2008Member Level: DiamondRating:     Points: 3

Hi,


An Dll or exe itself an assembly. It is a deployment unit. and what you want to do the Dll?. Assembly can contain the versionning, Mainfest , meta data, etc., will be inside an assembly.

Do you want to make any assembly as Shared or public?

then you need to create a Strong name key and then you can add it in GAC and then you can use it from any application .

check the below site to create a shared or public assembly.

http://quickstart.developerfusion.co.uk/QuickStart/howto/doc/sharedname.aspx

http://softwarecommunity.intel.com/Wiki/.NET/173.htm



Regards
JK



Author: Anjan    05 Sep 2008Member Level: SilverRating:     Points: 15

Hi,
Basically assembly are in two formats i.e.., dll or exe.
Assemblies are two types, private and shared assemblies.
So, you have created a dll file by default this is private assembly. If you want to make it as a shared that means that your assembly can used by other applications. In order to do that one you need to generate strong name, to generate a strong name use sn.exe.
To create shared assembly follow the steps below

1.In Microsoft VS Command prompt
sn -k key1.snk

2. After that go to AssemblyKeyInfo.cs or AssemblyKeyInfo.vb file and
add [AssemblyKeyFile("c:\key1.snk")] (in C#)
or <AssemblyKeyFile("C:\key1.snk")> (in VB.NET)
or you can go to project properties and do the same.

3. Then build your application.

4. In Microsft VS command prompt, enter gacutil -a <assemblyname>
it will directly copy to assembly folder(C:\windows\assembly)





Author: Appukuttan    05 Sep 2008Member Level: DiamondRating:     Points: -20

Assembly creation
The code shown in Listing 1 is to create an assembly programmatically. The code written is written in the C# language. The purpose of the code is to create an assembly with a class added to it. We also add a method to the class and finally save the dynamic assembly to the local system.

Listing 1
AppDomain currentDomain = Thread.GetDomain();
AssemblyName myAssemblyName = new AssemblyName();
myAssemblyName.Name = "Test";
myAssemblyName.Version = new Version(1, 0, 0, 0);
AssemblyBuilder builder = currentDomain.DefineDynamicAssembly(myAssemblyName,
AssemblyBuilderAccess.RunAndSave);
ModuleBuilder ObjModuleBuilder = builder.DefineDynamicModule("MyModule");
ObjModuleBuilder.DefineType("ClassName",
TypeAttributes.Class).DefineMethod("MethodName",
MethodAttributes.Public, CallingConventions.Standard);
builder.Save("MyAssembly.dll");
The AssemblyBuilder class is completely responsible for the creation of an assembly. An instance of the AssemblyBuilder class can be created by the current AppDomain. The steps for creating the assembly are listed below.

Step 1: Get the current application domain from the current thread.

Step 2: Create an object of the type AssemblyBuilder from the current application domain.

Step 3: Create the module builder object from the AssemblyBuilder.

Step 4: Create the different types, methods, etc. and add them to the Module Builder.

Step 5: Save the builder to the local system.

Refer:

http://aspalliance.com/1238_Creating_an_Assembly_Programmatically.2



Post Reply
You must Sign In to post a response.
Next : Encryption And Decryption?
Previous : how can i use storedprocedure in dotnet
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use