CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Sep 2011
    Posts
    4

    Problems referencing a Class library in C# Visual Studio 2008

    I was wondering if someone could help me with this problem....

    After creating a class library, I then created a new console application and when I tried to add reference to the class library (selecting project ->Add reference) I navigate down to the bin folder on the class library but it doesn't have the dll file. I created new librarys and console applications and try and reference them but still the same problem, no dll file in the class library. I'm using VS 2008 c#.

    Any ideas???


    thanks in advance.


    Ray

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Problems referencing a Class library in C# Visual Studio 2008

    Have you added the class library as a project in your solution? Did you reference the class library as a project in your solution or did you just point it to the dll?

    If you have done the latter (and the class library wasn't built previously), then the dll doesn't exist in the \bin folder of the class library and simply adding a reference in your console app project won't automatically build it.

  3. #3
    Join Date
    Sep 2011
    Posts
    4

    Re: Problems referencing a Class library in C# Visual Studio 2008

    Hi Arjay,

    thanks for your reply.

    I created the class library project and built the solution of that project.

    I then created a new console application, and tryed to reference to the class library dll file stored in the bin folder of the class library project. But the file doesn't exist.

    I believe this is how your able to reference a class library to your project. But I don't know where I'm going wrong.


    Ray

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Problems referencing a Class library in C# Visual Studio 2008

    If you want to reference the dll from the class library, you'll need to build the class library first. After you build it, make sure the dll is located in the \bin\debug or \bin\release folder.

    Then add the reference to the \bin\debug (or release) in the console project.

    That being said, the recommended way to reference another project, is to add the project to the solution (right click on solution in the solution explorer, choose "add\add existing project").
    Then add the reference to the class library in your console application, by selecting the Projects tab of the add wizard.
    This approach has the added benefit of ensuring that any changes made to your class library will be available to your console app.

  5. #5
    Join Date
    Sep 2011
    Posts
    4

    Resolved Re: Problems referencing a Class library in C# Visual Studio 2008

    Thanks Arjay,

    I manage to get my class library referenced now. The Dll file was in the release folder and not in the debug.

  6. #6
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Problems referencing a Class library in C# Visual Studio 2008

    Well, if it doesn't exits... you can't reference it. If you have the source it is preferable to just add the project to your solution and then add a reference to the project.
    If you liked my post go ahead and give me an upvote so that my epee.... ahem, reputation will grow.

    Yes; I have a blog too - http://the-angry-gorilla.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured