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

Discussion in 'ASP .Net' started by z. f., Jun 10, 2004.

  1. z. f.

    z. f. Guest

    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.
    z. f., Jun 10, 2004
    #1
    1. Advertising

  2. 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. f." <> wrote in message
    news:...
    > 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.
    >
    >
    >
    Eliyahu Goldin, Jun 10, 2004
    #2
    1. Advertising

  3. z. f.

    z. f. Guest

    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?



    "Eliyahu Goldin" <> wrote in message
    news:...
    > 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. f." <> wrote in message
    > news:...
    > > 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.
    > >
    > >
    > >

    >
    >
    z. f., Jun 13, 2004
    #3
  4. 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. f." <> wrote in message
    news:...
    > 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?
    >
    >
    >
    > "Eliyahu Goldin" <> wrote in message
    > news:...
    > > 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. f." <> wrote in message
    > > news:...
    > > > 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.
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Eliyahu Goldin, Jun 13, 2004
    #4
  5. z. f.

    z. f. Guest

    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.



    "Eliyahu Goldin" <> wrote in message
    news:...
    > 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. f." <> wrote in message
    > news:...
    > > 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?
    > >
    > >
    > >
    > > "Eliyahu Goldin" <> wrote in message
    > > news:...
    > > > 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. f." <> wrote in message
    > > > news:...
    > > > > 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.
    > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    z. f., Jun 13, 2004
    #5
  6. 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

    "z. f." <> wrote in message
    news:...
    > 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.
    >
    >
    >
    > "Eliyahu Goldin" <> wrote in message
    > news:...
    > > 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. f." <> wrote in message
    > > news:...
    > > > 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?
    > > >
    > > >
    > > >
    > > > "Eliyahu Goldin" <> wrote in message
    > > > news:...
    > > > > 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. f." <> wrote in message
    > > > > news:...
    > > > > > 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.
    > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Eliyahu Goldin, Jun 13, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    1
    Views:
    2,432
    Alvin Bruney
    Nov 2, 2003
  2. moondaddy
    Replies:
    4
    Views:
    727
    Steven Cheng[MSFT]
    Jul 27, 2004
  3. Amaryllis
    Replies:
    1
    Views:
    526
    Mark Rae
    Aug 10, 2004
  4. Patrick
    Replies:
    2
    Views:
    647
    Steven Cheng[MSFT]
    Oct 1, 2004
  5. Oodini
    Replies:
    1
    Views:
    1,762
    Keith Thompson
    Sep 27, 2005
Loading...

Share This Page