Create multiple projects inside a single project

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nightscorpion
    New Member
    • Jul 2008
    • 19

    #1

    Create multiple projects inside a single project

    Hello ,
    I have two projects A and B
    is it possible to import project B in project A?
    if not is there any alternative ?

    i tried to import project B as a subfolder. but since both the projects are in different namespaces project A doesnt recognise the namespace from Project B
    and since each of the projects contain a lot of files it is time consuming to change the namespaces fin each of the files.

    any suggestions would be very helpfull
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Without knowing what piece of software you are using your question is going to be impossible to answer.

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      You want to do this both in C++ and C#/VB?

      Comment

      • nightscorpion
        New Member
        • Jul 2008
        • 19

        #4
        sorry i posted my question at the wrong place.. i was asking this question based on visual studio c#

        Comment

        • Banfa
          Recognized Expert Expert
          • Feb 2006
          • 9067

          #5
          OK in Visual Studio (C/C++, C#, VB, SQL Database and all other projects) you can not have projects inside other projects.

          You have a Solution (or Workspace in VS 6.0 parlance) you add all you projects to the Solution. If the projects have dependencies on each other then you can set that with project dependencies and VS will then sort out building them in the right order.

          To start with if you are using VS 2005 C++ I find it useful to switch on the "Always show solution" option, this is in "Menu->Options..." then in the "Projects and Solutions" tree item. This is not required in VS 2005 C# because it doesn't have that option and it is always on.

          To add an existing project to your soltuion

          Right click on the Solution in the "Solution Explorer" and then select "Add->Existing Project ..." or select "Add->New Project ..." to add a new project.

          Once you have more than 1 project in your solution then right click the project in the solution explorer and select "Project Dependencies ...". In the displayed dialog you can select which prohjects depend on which other projects.

          Of course if one or more of you projects are class libraries to be used by the other projects then you will want to add them to the references of the projects that use them. Either right click the project and select "Add References ..." or expanded the project, right click the "References " folder and select "Add References ...". In the box that appears select the "Projects" tabs to add references from other projects that appear in you solution. This will then handle building the project and all its references for debug or release for you as required.

          Comment

          • nightscorpion
            New Member
            • Jul 2008
            • 19

            #6
            ok thanx a lot for ur reply..actually i earlier had 2 separate projects in a solution and both projects were depending on each other so i was getting a circular dependency.in order to prevent this circular dependendy..i was trying to combine both the projects in one as in eclipse.. but i guess since i cannot combine both the projects in one i need to go back to my earlier thinking thanx a lot for your reply...

            Comment

            • Banfa
              Recognized Expert Expert
              • Feb 2006
              • 9067

              #7
              A circular dependency is indicative of a design flaw and putting the boundaries between you assemblies in the wrong place.

              However if you wanted the 2 projects as 1 just include all the source into a single project.

              Comment

              • nightscorpion
                New Member
                • Jul 2008
                • 19

                #8
                hello,
                i have also tried to put the source files from the 2nd project(which are having a different namespace) in the first one but as a sub folder .

                but the problem is my main project cannot recognise the source files from this subfolder since they are having a different namespace..

                is it possible in visual studio to work with 2 different namespaces in a single project?

                Comment

                • Banfa
                  Recognized Expert Expert
                  • Feb 2006
                  • 9067

                  #9
                  Yes, after you have include the headers into the file just put

                  using namespace <YourNameSpace> ;

                  Comment

                  • nightscorpion
                    New Member
                    • Jul 2008
                    • 19

                    #10
                    Hello,
                    thank you..i succeeded so far..now i am able to import the source files from the folder .
                    However this folder again contains sub folders and these subfolders contain image (.bmp) files and i do not know how to gain access to these source files from the sub folders.
                    i tried it out with
                    private <subfolder>.<so urcefile> but unfortunately it doesnt work that way.

                    would be gratefull for any help provided

                    Comment

                    • nightscorpion
                      New Member
                      • Jul 2008
                      • 19

                      #11
                      sorry..thought i solved the problem but it isnt solved yet.. :(

                      Comment

                      • nightscorpion
                        New Member
                        • Jul 2008
                        • 19

                        #12
                        Hello,
                        i solved the problem with the namespaces..tha nx a lot guys for ur help

                        regards
                        sonia

                        Comment

                        Working...