Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio & Circular Dependency woes

I have a legacy system that's made up of 15 different projects and when I've tried to reference one from the other Visual Studio complains that it cannot do so as that would cause a circular dependancy.

My problem is that I can't see how it would cause a circular dependancy as the project I'm trying to reference ('XScript') doesn't have any sort of refence to the project that's trying to reference it ('WPF_Forms').

From researching around on here I've found people suffering similar fates though their problems seem to have obvious circular dependencies.

I've downloaded a demo copy of NDepend as recommended on a few posts from here and despite working through the various dependency tools on there there's still no obvious link.

I've right-clicked on the projects involved and used the "Project Dependencies" option but I can't see any link. I've also re-started Visual Studio and tried "Clean Solution" and "Re-build Solution" to no avail.

The only way round that I've been able to come up with is to reference 'XScript' by referencing the built DLL and not the project itself, however that feels a bit dirty and I want to know why this is happening rather just hack round it.

Can anyone suggest anything I may have missed or any strategies I could employ to work out what's going wrong?

EDIT 1 : XScript used to reference WPF_Forms but that reference has since been deleted (and the project cleaned and rebuilt with no dependencies showing on the 'Project Dependencies' window. I suppose it could be possible that VS has retained a link somewhere or that it thinks the projects are linked somehow.

EDIT 2 : Following on from BitBonk's suggestion I've ran used VS's Code Map feature and worked out the project topology. XScript and WPF_Forms are only referenced by the main .exe and nothing else. I'm beginning to suspect this is a VS issue and I may have to create a new project and add all the sub-projects in again to get it working.

like image 925
GrandMasterFlush Avatar asked Dec 08 '22 18:12

GrandMasterFlush


1 Answers

And the problem was: Visual Studio 2012.

After using Code Map like Bitbonk suggested I could see no references that would cause the problem. So, I removed both XScript and WPF_Forms from the project, ran a clean, added XScript back in ran a clean and then added WPF_Forms back in and ran a clean.

After that adding the reference from WPF_Forms to XScript didn't cause any problems. I can only guess this is a bug in VS that was triggered by it not recognising there was no longer a dependency from XScript to WPF_Forms.

Hopefully this question and the suggested answers will help someone else in future.

like image 71
GrandMasterFlush Avatar answered Dec 11 '22 08:12

GrandMasterFlush