Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to break a large VS solution into smaller solutions

We have a VS2008 solution file that contains around 80 projects (yes i know it sucks).

The projects are arranged in various folders, and some may depend on other 3rd party DLLs in a top level "Libs" folder.

We'd like to refactor this into several smaller .sln files, each containing a reasonable number of projects.

The problem is, when moving the project files around, the relative paths stored within them will break and so we will have to do lots of manual "patch ups" to fix that.

Is there any tool or any proven technique for doing something like this ?

like image 421
lysergic-acid Avatar asked Nov 14 '22 01:11

lysergic-acid


1 Answers

We did something similar, and to fix the references, we wrote a quick utility that would parse the .csproj or .vbproj files (which are basically xml files) and fix the affected paths based on where the .proj file itself was located after the refactoring. this was better than manually changing the project xml or adding removing references to avoid human errors.

Once you know where the proj file is and where common files (or other files) will be, you modify the Reference node in the project file with the relative path. So for e.g., you might have to change the original

<Reference Include="NHibernate">
      <HintPath>..\..\ServicesShared\Library\NHibernate.dll</HintPath>
</Reference> 

in the .proj file to

<Reference Include="NHibernate">
      <HintPath>..\Common\ServicesShared\Library\NHibernate.dll</HintPath>
</Reference> 

if that's where the NHibernate.dll lives now.

Hopefully this will work for you guys.

like image 162
Punit Vora Avatar answered Dec 05 '22 15:12

Punit Vora