0

I have 2 class libraries projects A and B, and A depends on (has a reference to) B.

In B I have a class to which I want to add XML comments, and mention a class in A using a <see cref="ClassInA"/>. The problem is that because B doesn't have a reference to A (only vice versa), then I get a warning:

CS1574: C# XML comment has cref attribute that could not be resolved

Is there a way to somehow "add a reference" but only for XML Comments purposes?

Clarification:

Project A contains an interface A.I and a method that takes A.I as an argument. Project B contains a default implementation of A.I, that should be used in most cases. In the comment I want to specify that in most cases you should pass the default implementation defined in B. But because B have dependencies on other libraries that in some cases are not desirable then the default implementation shouldn't be in A.

Arnon Axelrod
  • 1,444
  • 2
  • 13
  • 21
  • 1
    If you want to do this, then you're thinking back to front. `B` should **never** know about `A`, even in comments. – DavidG Apr 12 '18 at 11:49
  • You'll have to write the comment as text. From a systems design point of view I agree with @DavidG, and following his thought that B should not know about A it seems awkward (at best) to have a "hard" link to the class that is defined in A in the comments. – mortb Apr 12 '18 at 11:50
  • @DavidG: I added a clarification why I need this and still believe that my design is correct. – Arnon Axelrod Apr 13 '18 at 12:50
  • What you describe is impossible though. If `B` contains a class that implements an interface inside `A`, then `B` requires a reference to `A`. You say the reference is the other way round which would make it circular and wouldn't even build. – DavidG Apr 13 '18 at 12:52
  • I guess you're right. I was hoping that there's some kind of way to specify a reference inside the XML comment or through some sort of configuration which is not part of the regular project references. Apparently there's no such thing, and I have to describe it as a regular text. – Arnon Axelrod Apr 13 '18 at 14:52

0 Answers0