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

  • Thread starter Thread starter z. f.
  • Start date Start date
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.
 
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
 
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?
 
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
 
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.
 
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
 
Back
Top