Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Multiple Projects

clausesclauses Posts: 2Member
I have created a VB.Net solution that contains multiple projects. I have created a startup project that should access the other projects in the solution but I have been unable to reference the other projects from the startup project. When I try to include a reference to the other projects from the main I get a message that the project being referenced must be a dll. How can I create a dll for the project and if not how can I access the other projects from the StartUp/Main project.

Comments

  • kainsworthkainsworth Posts: 200Member
    What you need to do is to save the other projects (the non-startup ones) as Class Libraries. This will then make them DLLs and you can refer to them from your StartUp project.
    To do this, in the Solution Explorer, click on a project you want to save as a Class Library and right click its name. Select Properties from the bottom of the menu.
    In the popup box that then appears, go the Output Type combo at the left and select Class Library.
    Click Apply, then OK.

    Now back in your Soltion Explorer, you can reference this DLL in your startup project in the usual way using "Add reference" and selecting the "Projects" tab.

    You now have access from your startup project to the namespace(s) in the second or additional projects. To use any methods, properties, access controls, etc, on the other projects you either have to use fully qualified namespace names (eg. SecondProjectName.DoSomething) or you can use an Imports statement at the top of any file that needs to access the other projects.

    Hope this helps

    Ged

    ======================================================================


    : I have created a VB.Net solution that contains multiple projects. I have created a startup project that should access the other projects in the solution but I have been unable to reference the other projects from the startup project. When I try to include a reference to the other projects from the main I get a message that the project being referenced must be a dll. How can I create a dll for the project and if not how can I access the other projects from the StartUp/Main project.
    :

  • iwilld0itiwilld0it Posts: 1,134Member
    : I have created a VB.Net solution that contains multiple projects. I have created a startup project that should access the other projects in the solution but I have been unable to reference the other projects from the startup project. When I try to include a reference to the other projects from the main I get a message that the project being referenced must be a dll. How can I create a dll for the project and if not how can I access the other projects from the StartUp/Main project.
    :

    Those other projects in the solution should typically be a "Class Library" project rather than a "Windows Application", ONLY if your going to reference them in another project in the solution. Class library projects, compile into a dll.


  • kainsworthkainsworth Posts: 200Member

    :-( Have I missed something? I thought that was pretty much what I had said.




    :
    : Those other projects in the solution should typically be a "Class Library" project rather than a "Windows Application", ONLY if your going to reference them in another project in the solution. Class library projects, compile into a dll.
    :
    :
    :

  • iwilld0itiwilld0it Posts: 1,134Member
    [b][red]This message was edited by iwilld0it at 2004-10-13 10:57:19[/red][/b][hr]
    [b][red]This message was edited by iwilld0it at 2004-10-13 10:56:26[/red][/b][hr]
    :
    : :-( Have I missed something? I thought that was pretty much what I had said.
    :
    :
    :
    :
    : :
    : : Those other projects in the solution should typically be a "Class Library" project rather than a "Windows Application", ONLY if your going to reference them in another project in the solution. Class library projects, compile into a dll.
    : :
    : :
    : :
    :
    :

    You did not mention anything about creating Class Projects. I'm speculating that you just created three Windows Application projects which compiles to an exe not a dll. You cant create a .NET reference to an exe file.


    Otherwise, right click on the project your trying to reference (in the solution explorer.) Go to "Properties" then under "General" switch the "Output Type" tp "Class Library". Then try to reference that project in your main project. You may have to recompile.

  • kainsworthkainsworth Posts: 200Member
    OK, I don't want make this thread my life's work, but I'll give it one more go. :-)
    It seems to me that you are still telling the poster to do what I first told him to do.
    Let's call the projects which are to be referred to as "Ancilliary Projects".
    The person posting the question had already reached the stage where he had created a group of Win App projects and what he wanted was a fix for his reference problem, so the obvious next step was to change those he wants to refer to into Class Libraries.
    Of course he probably should have initially created the ancilliary projects as Class Libraries, but he hadn't and that was why he was at the impasse he'd reached. That's why I gave him the answer that he can simply switch the output type to Class Library as I described.
    I still can't see what value you've added to my answer that I hadn't already told him (unless you were trying to say that if he knew in advance that he was going to create ancilliary projects then, yes, of course it would make sense to choose "Class Library" as the project type in the first place....? Maybe that's what you meant .

    But, hey, it really isn't that important, so personally I'm going to move on to something more positive and chalk this one up to experience :-) No hard feelings.



    =====================================================================




    : [b][red]This message was edited by iwilld0it at 2004-10-13 10:57:19[/red][/b][hr]
    : [b][red]This message was edited by iwilld0it at 2004-10-13 10:56:26[/red][/b][hr]
    : :
    : : :-( Have I missed something? I thought that was pretty much what I had said.
    : :
    : :
    : :
    : :
    : : :
    : : : Those other projects in the solution should typically be a "Class Library" project rather than a "Windows Application", ONLY if your going to reference them in another project in the solution. Class library projects, compile into a dll.
    : : :
    : : :
    : : :
    : :
    : :
    :
    : You did not mention anything about creating Class Projects. I'm speculating that you just created three Windows Application projects which compiles to an exe not a dll. You cant create a .NET reference to an exe file.
    :
    :
    : Otherwise, right click on the project your trying to reference (in the solution explorer.) Go to "Properties" then under "General" switch the "Output Type" tp "Class Library". Then try to reference that project in your main project. You may have to recompile.
    :
    :

  • iwilld0itiwilld0it Posts: 1,134Member
    To be honest, I dont recall seeing your original response to the user; which I just read now. So we both basically gave him the same answer (you first obviously). I had no clue what you talking about until now; my apologies.
Sign In or Register to comment.