Reputation: 6565
I have a project, Project 1
, that I've included in another project (Project 2
). I'm trying to access a Function from Project 2
in Project 1
. I can navigate to the function in my solution from Project 2
, but when trying to access it from my file in Project 1
I can't seem to get access.
I've also tried adding a reference but, I get a message saying I already have a reference to Project 2
in Project 1
; which I guess happened when I added it to the solution. Can anyone help me solve this issue? Thanks!
EDIT Perhaps I explained the structure of my solution poorly. Here is a "visual" representation of my Solution Explorer...
Solution 'Project1' (2 projects)
Project1
Folders
Files
Project2
Folders
Files
Upvotes: 1
Views: 884
Reputation: 1094
Make sure that you have added a reference to the project you want to access, in the project you want to access it from. You can do this by right clicking the project in the solution explorer > Add Reference.. > Click the solution tab > Check the project you want to access > OK.
Make sure that the class you want to access is "Public".
Remember to use the full name of whatever you are trying to access in Project2. As example, if you have a class named "MyClass", which is inside of a namespace named "SomeClasses", you would have to target "MyClass" like this: Project2.SomeClasses.MyClass. You can also use the "Import" keyword so that you don't have to write the full path each time.
Upvotes: 2