473,587 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sharing Code

Greetings,

I'd like to write any number of classes and then use those classes from any
number of .NET applications.

Since we've supposedly left "DLL Hell" and ActiveX objects behind, what has
taken it's place.

Can anyone point me in the right direction getting started learning the best
way to write a library of routines and then being able to access those
routines from several different .NET applications?

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Aug 18 '07 #1
27 1989
Jonathan Wood wrote:
Greetings,

I'd like to write any number of classes and then use those classes from
any number of .NET applications.

Since we've supposedly left "DLL Hell" and ActiveX objects behind, what
has taken it's place.
We are still using dll files. We just left most of the hellish parts of
it behind us.

For example:

Avoiding DLL Hell: Introducing Application Metadata in the Microsoft
..NET Framework
http://msdn.microsoft.com/msdnmag/is...a/default.aspx
Can anyone point me in the right direction getting started learning the
best way to write a library of routines and then being able to access
those routines from several different .NET applications?
Create a Class Library project and put some classes in it. You can
either compile this and use the dll file produced, or add the project to
any solution.

--
Göran Andersson
_____
http://www.guffa.com
Aug 18 '07 #2
It's a piece of cake. You basically create a "Class Library" project. That
will create a DLL. All your classes will be in one or more namespaces that
you create inside that DLL.

In projects that use that library, you simply add a reference to the DLL in
your project.

Let's say you have the namespace MyLib and the class MyClass in it.

You then create an application. In your application project, you'll
reference MyLib.dll

In your code, you'll do something like this:

using MyLib;

void SomeMethod()
{
MyClass myClass = new MyClass();
}

And that's all there is to it, really. Couldn't be much simpler.

You simply deploy a copy of the DLL in the same directory as your
application.

Thing can get more complex. You can start getting into signed applications
and versioning issues, but for the most part, it's pretty easy.

Pete

"Jonathan Wood" <jw***@softcirc uits.comwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Greetings,

I'd like to write any number of classes and then use those classes from
any number of .NET applications.

Since we've supposedly left "DLL Hell" and ActiveX objects behind, what
has taken it's place.

Can anyone point me in the right direction getting started learning the
best way to write a library of routines and then being able to access
those routines from several different .NET applications?

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Aug 18 '07 #3
Jonathan Wood wrote:
Greetings,

I'd like to write any number of classes and then use those classes
from any number of .NET applications.

Since we've supposedly left "DLL Hell" and ActiveX objects behind,
what has taken it's place.

Can anyone point me in the right direction getting started learning
the best way to write a library of routines and then being able to
access those routines from several different .NET applications?
You put them in DLLs. This doesn't result in "DLL Hell" because such DLLs
are then generally deployed "app local" - in the applications 'bin'
directory, rather than in some silly place like %systemroot%.

-cd
Aug 19 '07 #4
Carl,
>Can anyone point me in the right direction getting started learning
the best way to write a library of routines and then being able to
access those routines from several different .NET applications?

You put them in DLLs. This doesn't result in "DLL Hell" because such DLLs
are then generally deployed "app local" - in the applications 'bin'
directory, rather than in some silly place like %systemroot%.
That wouldn't work very well if I was using the lib from several different
applications. Either I'd need to put all the applications in the same
directory, or I'd need store multiple copies of the DLL.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Aug 19 '07 #5
Yep, I tried that and it worked fine. That was easy. Although, the idea of
copying shared libraries to a subfolder of each application that uses the
libraries is definitely out.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"pedrito" <pixbypedrito at yahoo.comwrote in message
news:Io******** *************** *******@giganew s.com...
It's a piece of cake. You basically create a "Class Library" project. That
will create a DLL. All your classes will be in one or more namespaces that
you create inside that DLL.

In projects that use that library, you simply add a reference to the DLL
in your project.

Let's say you have the namespace MyLib and the class MyClass in it.

You then create an application. In your application project, you'll
reference MyLib.dll

In your code, you'll do something like this:

using MyLib;

void SomeMethod()
{
MyClass myClass = new MyClass();
}

And that's all there is to it, really. Couldn't be much simpler.

You simply deploy a copy of the DLL in the same directory as your
application.

Thing can get more complex. You can start getting into signed applications
and versioning issues, but for the most part, it's pretty easy.

Pete

"Jonathan Wood" <jw***@softcirc uits.comwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>Greetings,

I'd like to write any number of classes and then use those classes from
any number of .NET applications.

Since we've supposedly left "DLL Hell" and ActiveX objects behind, what
has taken it's place.

Can anyone point me in the right direction getting started learning the
best way to write a library of routines and then being able to access
those routines from several different .NET applications?

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Aug 19 '07 #6
Jonathan Wood <jw***@softcirc uits.comwrote:
Yep, I tried that and it worked fine. That was easy. Although, the idea of
copying shared libraries to a subfolder of each application that uses the
libraries is definitely out.
Why? It has distinct advantages:

1) It's really obvious which version of the library you're using
2) You can replace that version very easily
3) You don't need any extra setup steps

You *can* use the GAC for all of this, but in my view that makes it
easier to fall into versioning problems again. It's all do-able in
theory, but it's easy to make mistakes.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Aug 19 '07 #7
Jon (as usual), is right about this. You're going to make your life harder
if you use the GAC.

In my personal and professional experience (I work on a very large scale
commercial .NET based app), it is much easier to simply ship the proper
version with the app and keep them together in the same folder. I've never
found a reason to use the GAC.

The whole idea of "DLL hell" was based on the problem of multiple apps
wanting to use different versions of the same DLLs in the Windows/System32
folder, and using the GAC is just relocating the problem. Granted, the GAC
allows multiple versions to co-exist, but it's still more problematic than
just keeping the DLLs with the app.
"Jon Skeet [C# MVP]" <sk***@pobox.co mwrote in message
news:MP******** *************@m snews.microsoft .com...
Jonathan Wood <jw***@softcirc uits.comwrote:
>Yep, I tried that and it worked fine. That was easy. Although, the idea
of
copying shared libraries to a subfolder of each application that uses the
libraries is definitely out.

Why? It has distinct advantages:

1) It's really obvious which version of the library you're using
2) You can replace that version very easily
3) You don't need any extra setup steps

You *can* use the GAC for all of this, but in my view that makes it
easier to fall into versioning problems again. It's all do-able in
theory, but it's easy to make mistakes.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Aug 19 '07 #8
"Jonathan Wood" <jw***@softcirc uits.comwrote in message
news:uu******** ******@TK2MSFTN GP03.phx.gbl...
Carl,
>>Can anyone point me in the right direction getting started learning
the best way to write a library of routines and then being able to
access those routines from several different .NET applications?

You put them in DLLs. This doesn't result in "DLL Hell" because such
DLLs are then generally deployed "app local" - in the applications 'bin'
directory, rather than in some silly place like %systemroot%.

That wouldn't work very well if I was using the lib from several different
applications. Either I'd need to put all the applications in the same
directory, or I'd need store multiple copies of the DLL.
Can you explain to us why this wouldn't work? Just curious. You seem pretty
convinced this is a problem, but maybe you're seeing problems where problems
don't exist. If you can tell us why that won't work, maybe we can understand
a little better what the problem is.
Aug 19 '07 #9
Jon,
>Yep, I tried that and it worked fine. That was easy. Although, the idea
of
copying shared libraries to a subfolder of each application that uses the
libraries is definitely out.

Why?
At least for in-house libraries, think about what happens when you fix
something in the library. You now need to update all those copies. I guess
it's just a matter of a spending a little time copying the file as long as
you have an always-current list of every application that uses each library,
but I prefer not to have to track that kind of thing. It is definitely more
error prone and can raise issues when you find out one of the applications
isn't using the latest fixes.
1) It's really obvious which version of the library you're using
It's more obvious if every application on your computer is referencing the
same DLL.
2) You can replace that version very easily
It's easier to only replace it in one location.
3) You don't need any extra setup steps
Obviously, my take is a little different on this.
You *can* use the GAC for all of this, but in my view that makes it
easier to fall into versioning problems again. It's all do-able in
theory, but it's easy to make mistakes.
The types of versioning issues typical with so-called DLL Hell have not
really been an issue for me using my own libraries. It's definitely
something to at least consider with libraries you plan to distribute widely.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Aug 19 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4100
by: Dennis Gavrilov | last post by:
Hi, All! I have two questions: strategic and technical. Technical one first: I need to share an array of objects (implemented as hashes, having references to other objects and hashes, sharing done after blessing) between all of the mod_perl2 threads. The structure can grow quite big - tenths of thousands of array elements. It can grow as...
1
1940
by: Simon Neve | last post by:
Hello, This question is related to sharing .Net projects across solutions and is reposted from the SourceSafe group. We have several different solutions and want to share common assemblies across them. Is it best to share the project and its files to each solution (each solution has it's own shared project), or have each solution point...
6
5892
by: varlagas | last post by:
We disabled the antivirus software but the problem persists. Any clues? Many thanks in advance! Panagiotis Varlagas ======================================================================= 2005-07-28-10.39.02.015001 Instance:DB2 Node:000 PID:1568(db2syscs.exe) TID:2440 Appid:0A00153A.C90B.050728083720
3
2843
by: Robert W. | last post by:
I'm embarking on a project that will have both a desktop application and a Pocket PC application. It seems logical to have as much code as possible sitting in a shared project, which would be referenced and utilized by both the Windows Forms application and the Mobile Device application. Are there any "gotchas" (ie. warnings) that anyone...
5
2427
by: Jeff | last post by:
Hi - I'm creating an installation program that will install a VB.NET program and an instance of MSDE on an unknown desktop (commercial application). The install will include the MSDE redistributable files (and it will launch the MSDE Setup.exe to install MSDE). I've read that "Except on Win 98 and Millennium, file and print sharing must...
1
1505
by: Joe | last post by:
While I understand that Server Side Includes still work, I realize it's not the best practice for sharing code such as a common set of includes between screens. In ASP.NET I've already built several User Controls and such for sharing code between screens, but this typically was used things such as menus and headers and footers. What is...
0
1265
by: Daniel P. | last post by:
http://danutp.blogspot.com/ Web Services - sharing data between client and server Dealing a lot with web services a friend of mine (Ehsan Samani) and I ran into another issue: when we move data from web services to the smart client and back the classes created by the proxy are not identical with the ones on the web services side. If the...
0
1540
by: Emily | last post by:
Imagine a world where everybody shares and has faith in each other. We have all struggled at one time or another with our jobs or careers and have wondered if there was a better way to make a living. What if the solution was just to help each other, simply by giving and receiving. This would be a radical global experiment in faith. Imagine...
8
4839
by: mc | last post by:
I would like to be able to send from an ASP.NET page an email which when recieved takes the form of a "Sharing Invitation for a RSS Feed" (http://office.microsoft.com/en-us/outlook/HA101595391033.aspx) I've found a MSDN article about it (http://msdn2.microsoft.com/en-us/library/bb176432.aspx) but that example is presented as a vb(a) script...
11
3601
by: limperger | last post by:
Hello everybody! I have just found out that the sharing properties of a single database (mdb file on a network), accessed by 3 users, change depending on the user accessing the database. That is, with the file opened by 2 users at the same time, in my computer, the sharing properties appeared as set to share (not exclusive) and single...
0
7923
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7852
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8221
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5719
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.