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. Visual Studio
  4. How to access methods from other project in solution?

How to access methods from other project in solution?

Scheduled Pinned Locked Moved Visual Studio
questionvisual-studiotutorial
5 Posts 3 Posters 22 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.
  • 0 Offline
    0 Offline
    0x49D1
    wrote on last edited by
    #1

    Hello I have such question(may be its simple,but i couldnt resolve it myself:( ): i have solution with 2 projects.In the second one i need to access some methods from the first and for that i do the following: add the reference in the second project to a project dll from the first one.Then,when i need to use methods i call using namespace_from_first_proj; namespace Second_proj_namespace { public class SecondProjClass { FirstProjClass.Method();// want to use static method from first project(class FirstProjClass is from namespace_from_first_proj namespace),but VS doesnt let me to do that :( } } So..The the class from the second project SEES class from first,but doesnt see its methods:(..why?

    I 1 Reply Last reply
    0
    • 0 0x49D1

      Hello I have such question(may be its simple,but i couldnt resolve it myself:( ): i have solution with 2 projects.In the second one i need to access some methods from the first and for that i do the following: add the reference in the second project to a project dll from the first one.Then,when i need to use methods i call using namespace_from_first_proj; namespace Second_proj_namespace { public class SecondProjClass { FirstProjClass.Method();// want to use static method from first project(class FirstProjClass is from namespace_from_first_proj namespace),but VS doesnt let me to do that :( } } So..The the class from the second project SEES class from first,but doesnt see its methods:(..why?

      I Offline
      I Offline
      il_masacratore
      wrote on last edited by
      #2

      Have you used "public static.." modifiers in this method declaration?

      Visit my blog at http://dotnetforeveryone.blogspot.com

      0 1 Reply Last reply
      0
      • I il_masacratore

        Have you used "public static.." modifiers in this method declaration?

        Visit my blog at http://dotnetforeveryone.blogspot.com

        0 Offline
        0 Offline
        0x49D1
        wrote on last edited by
        #3

        yes,sure..all methods i need are 'public static'

        I 1 Reply Last reply
        0
        • 0 0x49D1

          yes,sure..all methods i need are 'public static'

          I Offline
          I Offline
          il_masacratore
          wrote on last edited by
          #4

          How have you added the reference? Adding a dll reference(on tab dll reference) or a project reference(on Other projects reference)?

          Visit my blog at http://dotnetforeveryone.blogspot.com

          F 1 Reply Last reply
          0
          • I il_masacratore

            How have you added the reference? Adding a dll reference(on tab dll reference) or a project reference(on Other projects reference)?

            Visit my blog at http://dotnetforeveryone.blogspot.com

            F Offline
            F Offline
            FeedScrn
            wrote on last edited by
            #5

            F.Y.I... In VS2017 there is something called Shared Projects and a Reference Manager... where a common piece of code can be used in multiple projects. ETA: It appears that these: Reference Manager / Shared Projects are two different things, which work similarly. I'm still researching how this all works, but it sounds promising... ref1: How to: Add or remove references by using the Reference Manager Add references in the Reference Manager - Visual Studio | Microsoft Docs[^] ref2: Shared Projects code sharing Use Shared Projects to Share Code - Xamarin | Microsoft Docs[^]

            Take Care God Bless... Feedscrn +------------------------------+ | The screen is hungry, Feed 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