calling a class defined in an ASP.NET project from windows application

Z

z. f.

Hi,

I'm working on a web project and i create classes to do business logic and
connect to DB.
i also need a windows application to do the same functionality as defined
in classes inside the ASP.NET project.
when i reference the web project DLL (inside the BIN directory) I
successfully make a call to a function and get return value.

but this is just a test and when trying to access the application
configuration information (defined in web.config) i get empty string in
return.

is there a way to share functionality between web and windows/service
projects?

TIA, zigi.
 
E

Eliyahu Goldin

Take you classes with business logic and data access into separate projects
in separate directories. They will compile to class libraries (assemblies).
Make another solution for the windows application and include the class
library projects there. You will have separate solutions for web and windows
applications sharing the same business and data access projects. In no way
your windows solution will need any access to web.config that belongs to
your web solution.

Eliyahu
 
Z

z. f.

when i reference my web DLL form a Console application, the VIsual Studio
makes a copy of the Web DLL (that i referenced) in the bin directory of the
Console project.
what happend if i make changes to the web DLL?
will it not reference the correct location - just a copy?
 
E

Eliyahu Goldin

What you call Web DLL is probably what I call class library and it is the
output of a separate project. Correct?
If you change it, the best advice is to rebuild your console solution. It
will pickup the changes and copy them into its bin directory.

Eliyahu
 
Z

z. f.

thanks, but i guess my question is how do i configure the second project to
use the DLL/class library from it's original location i know there is a way
to configure the dot.net about DLLs locations right?
thanks.
 
E

Eliyahu Goldin

Ok, there are 2 separate issues here.

1. Whether the dll is a part of your solution or no. You don't have to
include it in the solution as a project. You can add it as a .NET reference.
In the Add Reference dialog you will find a page for adding .NET references.

2. Whether to copy the dll locally into your solution's bin directory. You
will find this option in the reference properties dialog. This option is
available for both project and .NET references. If you set it to false, your
solution should access the dll at it's original location.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top