Share common code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm a newbie to Dot NET. Can anyone show me how to compile a reusable code
repository so that codes can be reused by a number of Web Forms in the .NET
Framework. In the classic ASP, Include files are used but I don't know how to
do it in C#.Net.

Any help is greatly appreciated.
 
From within Visual Studio:

Create a "Class Library" Project and put your common code in there. Be sure to mark all the classes that wou want visible as public. Set a reference to this project from the applications that want to use the common code.

From the command line:

Put roud classes in one or more .cs files making sure to mark all the necessary exposed classes as public then run
csc /t:library *.cs
to create a .dll. This then needs to be referenced by the applications using the common code

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.framework/<[email protected]>

I'm a newbie to Dot NET. Can anyone show me how to compile a reusable code
repository so that codes can be reused by a number of Web Forms in the .NET
Framework. In the classic ASP, Include files are used but I don't know how to
do it in C#.Net.

Any help is greatly appreciated.

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.768 / Virus Database: 515 - Release Date: 22/09/2004



[microsoft.public.dotnet.framework]
 
Thanks Richard.
Will those dlls automatically be part of the .NET application at deployment
(packaged) or do you have to administer them separately on the Server?

I'm using Visual Studio 2003 with DotNET version 1.1
 
If you build the MSI using VS.NET then yes, they wikll be part of the deployment package.

The only issue you may get is that you will end up with multiple copies of the shared assembly - one for each application. This is not necessarily a problem. If you only want one copy you will have to install the shared assembly in the GAC which means strong naming it.

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.framework/<[email protected]>

Thanks Richard.
Will those dlls automatically be part of the .NET application at deployment
(packaged) or do you have to administer them separately on the Server?

I'm using Visual Studio 2003 with DotNET version 1.1

Richard Blewett said:
From within Visual Studio:

Create a "Class Library" Project and put your common code in there. Be sure to mark all the classes that wou want visible as public. Set a reference to this project from the applications that want to use the common code.

From the command line:

Put roud classes in one or more .cs files making sure to mark all the necessary exposed classes as public then run
csc /t:library *.cs
to create a .dll. This then needs to be referenced by the applications using the common code

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.framework/<[email protected]>

I'm a newbie to Dot NET. Can anyone show me how to compile a reusable code
repository so that codes can be reused by a number of Web Forms in the .NET
Framework. In the classic ASP, Include files are used but I don't know how to
do it in C#.Net.

Any help is greatly appreciated.

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.768 / Virus Database: 515 - Release Date: 22/09/2004



[microsoft.public.dotnet.framework]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.768 / Virus Database: 515 - Release Date: 22/09/2004



[microsoft.public.dotnet.framework]
 
That's OK.
Thanks Richard.

Richard Blewett said:
If you build the MSI using VS.NET then yes, they wikll be part of the deployment package.

The only issue you may get is that you will end up with multiple copies of the shared assembly - one for each application. This is not necessarily a problem. If you only want one copy you will have to install the shared assembly in the GAC which means strong naming it.

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.framework/<[email protected]>

Thanks Richard.
Will those dlls automatically be part of the .NET application at deployment
(packaged) or do you have to administer them separately on the Server?

I'm using Visual Studio 2003 with DotNET version 1.1

Richard Blewett said:
From within Visual Studio:

Create a "Class Library" Project and put your common code in there. Be sure to mark all the classes that wou want visible as public. Set a reference to this project from the applications that want to use the common code.

From the command line:

Put roud classes in one or more .cs files making sure to mark all the necessary exposed classes as public then run
csc /t:library *.cs
to create a .dll. This then needs to be referenced by the applications using the common code

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.framework/<[email protected]>

I'm a newbie to Dot NET. Can anyone show me how to compile a reusable code
repository so that codes can be reused by a number of Web Forms in the .NET
Framework. In the classic ASP, Include files are used but I don't know how to
do it in C#.Net.

Any help is greatly appreciated.

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.768 / Virus Database: 515 - Release Date: 22/09/2004



[microsoft.public.dotnet.framework]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.768 / Virus Database: 515 - Release Date: 22/09/2004



[microsoft.public.dotnet.framework]
 
Back
Top