Using a class from a different project

Hey,

I have a solution with three projects, let's call them projectA, projectB and projectC.

ProjectC contains objects of projectA and has a reference to projectB.
ProjectB has a reference to projectA.
However, I want an object in projectA (that is used in projectC) to use a certain class with functions in projectB. The problem is that I cannot add projectB as a reference because this would cause circular dependency (due to the reference projectB has to projectA).

Can anyboy offer me a solution so I can use the functions in the class in projectB? Copying the functions to projectA or removing the reference to projectA in projectB is not an option...

Thanks!
LVL 5
tsayAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
You can link files from one project to another without having to add them physically through the 'Add Item' dialog.  The <Open> button has a drop-down button, which has a 'Link File' option.

Bob
tsayAuthor Commented:
I have no idea what button you mean? This <open> button?
I want all the logic to stay in projectB...
Bob LearnedCommented:
1) Add Existing Item
2) Look down at the lower-right hand corner of the dialog box
3) Click on the down-arrow
4) The logic will "stay" in project B, but you will be able to use it in the other project.
5) Usually this situation can be solved by a better class design.


Bob
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

Bob LearnedCommented:
3) Click on the down arrow, and select 'Link File'.

Bob
tsayAuthor Commented:
I see where you're going at but it won't work. First of all I get some build errors telling me things like ClassIwantToUse is ambiguous?

I know about the class design, wish I could change it but sh*t falls down so I have to deal with it like it is...

Any other solution?
Bob LearnedCommented:
You are going to have to give me a better description of what you are doing.  Do you already have a class in the project that has the same name as a class from the other project?

Bob
tsayAuthor Commented:
No there's no class in projectA that is named like the one I want to use from projectB.
Bob LearnedCommented:
Ok, project B has a reference to project A, so in different way you have created a circular reference.

Bob

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tsayAuthor Commented:
I found the problem, in projectC there is a class that imports from both projectA and projectB, that's why it's ambigious...
PockyMasterCommented:
Yeah, in that case you need to specify the full namespace in your class name
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.