0

I have a C# project that compiles fine in Visual Studio, but when I use a nant build script I get the following error:

"error CS0146: Circular base class dependency involving ClassA and BaseClassA"

Here is the structure of the classes:

BaseClassA : IEnumerable<ClassA.ClassB>
{
}

----

ClassA : BaseClassA
{
  ClassB
  {}
}

I understand the circular dependency part but VS is doing something to allow that to work. I would like to keep this structure and it compiles fine in Visual Studio. My question is, why is not compiling in nant and what can I do so it will compile in nant?

mojoker
  • 308
  • 2
  • 14
  • I think it's important for you to share with us the details of BaseClassA. Why did you leave that out? – Jazimov Apr 24 '18 at 15:14
  • I don't think the details of BaseClassA are relevant since the circular dependency is with the IEnumerable type and not in the details of the class. – mojoker Apr 25 '18 at 13:12
  • OK, I wasn't sure from your post whether the circular dependency is being detected in your BaseClassA code. Can you start with just an empty/skeletal program (as above) to see if Nant still complains? If it doesn't, then start adding code and observe when Nant begins to complain. A bit of work but might be worth the effort. Also, you mention a Nant build script. Is the **compilation** step failing--or is there something in your build script that Visual Studio doesn't need to do that might be failing and therefore restricted to Nant? – Jazimov Apr 25 '18 at 14:03
  • It would help if you gave a build script showing which particular way you're building it, that would give a [mcve]. I know you're not asking for design advice, but the close coupling and inheritance of enumerability over the nested class makes me think that you may find this useful... https://stackoverflow.com/questions/21692193/why-not-inherit-from-listt/21694054#21694054 – Richardissimo Apr 27 '18 at 05:41

0 Answers0