Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. 2 projects 1 class

2 projects 1 class

Scheduled Pinned Locked Moved C#
question
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    albean
    wrote on last edited by
    #1

    I have one solution with two projects (project A & project B). Is there a way to "reference" a class in A from within B? If I'm in project B and from the solution's explorer I choose "Add Existing Item" it copies the file from A's physical directory into B's directory. I'm sorta trying to forward reference the class.

    D 1 Reply Last reply
    0
    • A albean

      I have one solution with two projects (project A & project B). Is there a way to "reference" a class in A from within B? If I'm in project B and from the solution's explorer I choose "Add Existing Item" it copies the file from A's physical directory into B's directory. I'm sorta trying to forward reference the class.

      D Offline
      D Offline
      David Stone
      wrote on last edited by
      #2

      Right click on project B, go to Add Reference..., go to the projects tab, select project A and add the reference. That should work. :)


      I have also lived some years in Spain, and there people don't accept that you speak bad spanish. I usually compensate by speaking loud and accusing people of being stupid because they don't understand me. It usually works quite well. -jhaga on non-native languages

      A 1 Reply Last reply
      0
      • D David Stone

        Right click on project B, go to Add Reference..., go to the projects tab, select project A and add the reference. That should work. :)


        I have also lived some years in Spain, and there people don't accept that you speak bad spanish. I usually compensate by speaking loud and accusing people of being stupid because they don't understand me. It usually works quite well. -jhaga on non-native languages

        A Offline
        A Offline
        albean
        wrote on last edited by
        #3

        Thanks, but Project A is not class lib (dll). Its an EXE that contains a class that I need to use in Project B.

        D D 2 Replies Last reply
        0
        • A albean

          Thanks, but Project A is not class lib (dll). Its an EXE that contains a class that I need to use in Project B.

          D Offline
          D Offline
          Daniel Turini
          wrote on last edited by
          #4

          albean wrote: Thanks, but Project A is not class lib (dll). Its an EXE that contains a class that I need to use in Project B. You either make it a .dll or include the file as a link. On the "Add Existing Item..." dialog, do you see the small arrow on the "Open" button? Click it and select "Link file". This way, you'll create a link on your project B to the class on the project A. This will have the side effect of including the code of the class on the project B, too, but I think that this is exactly what you're looking for, right? Acting as a substitute for God, he becomes a dispenser of justice. - Alexandre Dumas

          1 Reply Last reply
          0
          • A albean

            Thanks, but Project A is not class lib (dll). Its an EXE that contains a class that I need to use in Project B.

            D Offline
            D Offline
            David Stone
            wrote on last edited by
            #5

            Why not create a shared dll that resides between them. That's what I usually do if I need to create two apps that share some of the same basic functionality.


            I have also lived some years in Spain, and there people don't accept that you speak bad spanish. I usually compensate by speaking loud and accusing people of being stupid because they don't understand me. It usually works quite well. -jhaga on non-native languages

            A 1 Reply Last reply
            0
            • D David Stone

              Why not create a shared dll that resides between them. That's what I usually do if I need to create two apps that share some of the same basic functionality.


              I have also lived some years in Spain, and there people don't accept that you speak bad spanish. I usually compensate by speaking loud and accusing people of being stupid because they don't understand me. It usually works quite well. -jhaga on non-native languages

              A Offline
              A Offline
              albean
              wrote on last edited by
              #6

              Thanks David. That seems to do it.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups