• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

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!
0
tsay
Asked:
tsay
  • 5
  • 4
1 Solution
 
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
0
 
tsayAuthor Commented:
I have no idea what button you mean? This <open> button?
I want all the logic to stay in projectB...
0
 
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
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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

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

Bob
0
 
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...
0
 
PockyMasterCommented:
Yeah, in that case you need to specify the full namespace in your class name
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now