Add reference from Class Library to Web Project doesn't work??

Last post 02-10-2005 8:36 PM by aka. 30 replies.

Sort Posts:

  • Add reference from Class Library to Web Project doesn't work??

    11-08-2003, 9:29 AM
    • Member
      45 point Member
    • odarky
    • Member since 11-02-2003, 4:57 PM
    • Posts 9
    Hi, All

    I am having a problem adding "project" reference to web project in Visual Studio.NET "Whidbey". It just doesn't let me do that for some reason. I, however, can add "Assembly" reference to it, but if I recompile it, it won't effect in the web project unless I delete and add it again.

    Anyone can help me with this?

    Thank you,
    Anusidh
  • Re: Add reference from Class Library to Web Project doesn't work??

    11-09-2003, 5:00 AM
    • All-Star
      29,634 point All-Star
    • Fredrik N
    • Member since 06-22-2002, 5:03 AM
    • Sweden
    • Posts 5,334
    When you first add your assembly as a reference to the web project, it will take the current compiled version of the assembly and make a copy of it, which is added into the web project’s bin folder. If you recompile your solution the assembly will not be copied aging, and it’s why you have to remove it and add it again. The question is why isn’t there a reference node in the solution explorer for the web project? Why do we have to use the website menu or the Property pages menu to add a reference? I also got an error when I try to add a project reference to my web project. We could of course add the source code for our class library into the web project code directory, but I like the way to separate project into a solution and use project references. Maybe this feature will be added to the beta, and will not work now in the preview version because this version is only meant to be used for testing some of the new features in the upcoming .Net version 2.0?

    /Fredrik Normén NSQUARED2
    http://www.nsquared2.net
    /Fredrik Normén - fredrikn @ twitter

    ASPInsider

    Microsoft MVP, MCSD, MCAD, MCT

    ASPInsiders
    My Blog
  • Re: Add reference from Class Library to Web Project doesn't work??

    11-09-2003, 12:21 PM
    • Member
      15 point Member
    • philipr
    • Member since 10-20-2003, 9:07 PM
    • Posts 3
    Yes, while you can "refresh" the reference, it won't do it automatically. Also, this doesn't allow you to set a breakpoint in code in the assembly you referenced and step into it - makes debugging much harder.

    Is there some method available to reference another project from ASP.NET in whidbey, and allow 1) dependency tracking during builds (to update the referenced assembly), and 2) easy debugging across projects (like we have in vs.net 2003)?

  • Re: Add reference from Class Library to Web Project doesn't work??

    11-09-2003, 2:09 PM
    • Star
      14,228 point Star
    • ScottGu
    • Member since 06-05-2002, 8:36 PM
    • Redmond, WA
    • Posts 2,004
    • AspNetTeam
      Moderator
    Hi Philip,

    Unfortunately the project-to-project support wasn't fully implemented in the Whidbey alpha timeframe (we've basically re-built the project system from scratch in Whidbey -- and so are re-implementing all of the existing features).

    As such, there isn't a way to automatically update compiled references in a solution -- without manually copying the files over into the \bin directory again (which obviously is less than ideal).

    If there is any consolation, in the beta timeframe in the Spring this feature will obviously be back -- along with some new features not in VS 2003. Specifically, we'll support live project-to-project references, which means that changes in one project will automatically be reflected in consumer projects without requiring a build or full re-compile. For example: Intellisense against client library assemblies and web services will automatically update when public types or services are updated -- no "refresh" step required.

    Hope this helps,

    Scott
  • Re: Add reference from Class Library to Web Project doesn't work??

    11-09-2003, 3:02 PM
    • Member
      15 point Member
    • philipr
    • Member since 10-20-2003, 9:07 PM
    • Posts 3
    Scott -

    Helps a lot - I like many aspects of the new web project system - just wanted to make sure this wasn't going to stay on the cutting room floor, so to speak.

    I also understand why things like this are not in the alpha - no problem - but is there a listing somewhere of the plan of record for things like this so I don't waste your time asking questions like this on forums? (I'd much rather you put neat things into ASP.NET than explain to me why alpha software doesn't have 100% functionality!) Even some items listed may cut down on the questions.

    Thanks,
    Philip
  • Re: Add reference from Class Library to Web Project doesn't work??

    11-09-2003, 4:51 PM
    • Member
      90 point Member
    • bgoldy
    • Member since 03-24-2003, 6:16 PM
    • Redmond, WA
    • Posts 18
    Philip --

    This a great request and we are working on a whitepaper -- we'll post it to www.asp.net/whidbey/ once it is completed.

    Thanks!

    -Brian
    ---------------------------

    Brian Goldfarb [MS]

    Product Manager

    Visual Studio .NET
  • Re: Add reference from Class Library to Web Project doesn't work??

    12-02-2003, 3:06 PM
    • Member
      195 point Member
    • scdlee_quest
    • Member since 11-25-2003, 1:34 PM
    • Indianapolis, IN
    • Posts 39
    It appears that I do not have any access to my dll references after adding them to the bin folder.

    I have a business access layer that is referencing a data access layer without any problems.

    However, when I copy the business access dll to the bin of my web site I do not have any intellisense support or any support at all for the object.

    How do I get access to the objects within my bin folder?

  • Re: Add reference from Class Library to Web Project doesn't work??

    12-02-2003, 4:44 PM
    • All-Star
      29,634 point All-Star
    • Fredrik N
    • Member since 06-22-2002, 5:03 AM
    • Sweden
    • Posts 5,334
    Strange, I have assembly added to the bin folder and the intelligence works fine for me.

    Here is what I have done:

    I add an existing assembly to my web site project bin folder by selecting the bin folder of the web site project in the solution explorer. I choose add an existing item, and then I select my assembly and add it to the folder. After that, I could use my assemblies and the intelligence works fine.

    /Fredrik Normén - fredrikn @ twitter

    ASPInsider

    Microsoft MVP, MCSD, MCAD, MCT

    ASPInsiders
    My Blog
  • Re: Add reference from Class Library to Web Project doesn't work??

    12-02-2003, 7:55 PM
    • Participant
      1,089 point Participant
    • YugangW
    • Member since 11-27-2002, 5:55 PM
    • Posts 217
    • AspNetTeam
    If you add a valid managed assembly into /Bin, you should get intellisense immiediately in web pages
    If you can't get intellisense, you can F5 any web page and check out whether you get any runtime error. I initial guess is you might have some errors in other places such as /Code directory.
    Thanks
    Yugang
  • Re: Add reference from Class Library to Web Project doesn't work??

    12-03-2003, 8:21 AM
    • Member
      195 point Member
    • scdlee_quest
    • Member since 11-25-2003, 1:34 PM
    • Indianapolis, IN
    • Posts 39
    Ok, not sure what is going on. I created a new class project with one class and one method in it. I then created a new web application and was successfully able to add the reference to the class and have intellisense instantly available.

    I went back to my original web project, deleted the bin folder and then recreated the bin folder and added the exact same reference to the newly created class file and it still doesn't work.

    Not sure why my first web project is hosed...

    Thanks for the help,

    Scott
  • Re: Add reference from Class Library to Web Project doesn't work??

    12-12-2003, 5:02 PM
    • Participant
      1,680 point Participant
    • samsp
    • Member since 08-08-2002, 5:35 PM
    • Posts 330
    • AspNetTeam
    As suggested, Hit F5 in your project and see what errors are reported when you try and run. As we don't have explicit build support in the alpha, we don't have a good error reporting story when there is a problem with the web.
  • Re: Add reference from Class Library to Web Project doesn't work??

    06-09-2004, 7:03 PM
    • Member
      35 point Member
    • nigel.thorne
    • Member since 06-08-2004, 1:49 AM
    • Posts 7
    Hi Scott,

    I am using the May Beta of Whidbey, and I still can't add references to a "web site" project.

    I can add Web References, but the "Add Reference" button does nothing. no error, no dialog, nothing.

    Is this a configuration error on my local version, or is it a missing feature still?

    Thanks
    Nigel Thorne
  • Re: Add reference from Class Library to Web Project doesn't work??

    06-09-2004, 11:54 PM
    • All-Star
      29,634 point All-Star
    • Fredrik N
    • Member since 06-22-2002, 5:03 AM
    • Sweden
    • Posts 5,334
    I can add a reference, try to reset the IDE settings, go to Tools->Import/Export settings and select Reset IDE settings and choose the Web.vssetting file and press ok. I notice sometime that the Add Reference button will not open the reference dialog, but when that happens I restart VS 2005 and then everything works again. I use the May CTP on Windows 2003 Server.
    /Fredrik Normén - fredrikn @ twitter

    ASPInsider

    Microsoft MVP, MCSD, MCAD, MCT

    ASPInsiders
    My Blog
  • Re: Add reference from Class Library to Web Project doesn't work??

    06-10-2004, 9:43 AM
    • All-Star
      29,634 point All-Star
    • Fredrik N
    • Member since 06-22-2002, 5:03 AM
    • Sweden
    • Posts 5,334
    Hmm, if you read the readme file for VS 2005 and section "13.19. The Add Reference button in property pages dialog boxes does not work". It’s a known issue, but it still work for me and that’s strange.
    /Fredrik Normén - fredrikn @ twitter

    ASPInsider

    Microsoft MVP, MCSD, MCAD, MCT

    ASPInsiders
    My Blog
  • Re: Add reference from Class Library to Web Project doesn't work??

    06-10-2004, 7:12 PM
    • Member
      35 point Member
    • nigel.thorne
    • Member since 06-08-2004, 1:49 AM
    • Posts 7
    Nope, no luck.

    Thanks for trying.
    I'm using WinXP Pro V2002 service pack 1 with the May 2004 CTP.
Page 1 of 3 (31 items) 1 2 3 Next >