Thursday, March 22, 2012

Simple design question

Dear all,
I am developing an asp.net app which will be using functions which will more
than likely be used by other asp.net apps to come. Rather than code them al
l into the main app, I want these coded in their own dll so that other apps
can call them.
1. Presumably I create a separate dll in order to share these functions?
2. Where do I place this DLL on the server?
3. Presumably I can then right click on references and add the .net referenc
e to the dll?
Please excuse this simple question, but we all have to start somewhere...
Many thanks in advance for your valuable feedback.1. Correct. Create them in a class library project. To eliminate some
confusion, you should consider using the same namespace in both projects,
although their might also be good reasons for using different namespaces.
2. Place the .dll file in the same bin folder as the web application .dll
file.
3. Yes - or you could also click on the "project" tab of the references
window and add the entire project as a reference. I use this method all the
time.
Good luck
Mark
www.dovetaildatabases.com
"Andy" <Andy@.discussions.microsoft.com> wrote in message
news:4E933216-DABE-4000-9102-9999E4211D59@.microsoft.com...
> Dear all,
> I am developing an asp.net app which will be using functions which will
more than likely be used by other asp.net apps to come. Rather than code
them all into the main app, I want these coded in their own dll so that
other apps can call them.
> 1. Presumably I create a separate dll in order to share these functions?
> 2. Where do I place this DLL on the server?
> 3. Presumably I can then right click on references and add the .net
reference to the dll?
> Please excuse this simple question, but we all have to start somewhere...
> Many thanks in advance for your valuable feedback.
>
In article <4E933216-DABE-4000-9102-9999E4211D59@.microsoft.com>,
Andy@.discussions.microsoft.com says...
> Dear all,
> I am developing an asp.net app which will be using functions which will mo
re than likely be used by other asp.net apps to come. Rather than code them
all into the main app, I want these coded in their own dll so that other app
s can call them.
> 1. Presumably I create a separate dll in order to share these functions?
Yes.

> 2. Where do I place this DLL on the server?
The best place would probably be the Global Assembly Cache (gac).

> 3. Presumably I can then right click on references and add the .net reference to t
he dll?
Normally, items you've added to the gac yourself don't show up in the
"add reference" dialog. However, you simply browse for your DLL and it
will add a reference to it. When executing, the DLL will be found in
the GAC first and that copy will be used.
Or, there's a KB article on how to tweak the registry to get your gac-
installed item in the references dialog.
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

0 comments:

Post a Comment