1

I have been given a folder than contains many solutions in subfolders along with their code. Each solution builds a PrinterDriver.dll. What I am trying to do is create a master solution that I can add all the projects into and then they will all compile every time.

I cannot at the moment do this, when I add each to the master I get an alert telling me that a project of that name already exists. what is the best way to do this?

user3884423
  • 556
  • 1
  • 5
  • 20
  • make all the project names unique, either by renaming them, or combining the files of projects with the same names. – Jonesopolis Sep 15 '15 at 14:04
  • Using the same names for each project will get confusing. If the solutions have different name spaces, I think you can use the same named solutions, but by default, the namespace is the name of the solution. As Jonesopolis said, best practice is to name them differently. – VirtualLife Sep 15 '15 at 14:07
  • Rename the projects to Something.PrinterDriver, SomethingElse.PrinterDriver etc. – Arghya C Sep 15 '15 at 14:13
  • Did you need more info? Any questions or concerns? – Jeremy Thompson Sep 16 '15 at 11:28

1 Answers1

2

I'd urge you not to create a master solution containing projects with the same name, that will end up a mess... You'll have to change assembly names and namespaces and as you've found you end up with dozens of namespace ambiguity errors.

all the projects ... will all compile every time

If the aim is just to compile all the projects at once, every time, then simply write a MSBUILD script that uses all the project files to compile outputs.

Eg: Compiling a .vbproj or .csproj project file without Visual Studio


If you do want a master solution it will require surgery. One way would be to create interfaces (or abstract classes) that reflect the method signatures of each class in every project and using IoC load different implementation classes depending on the target.


Warning: Be wary about changing namespaces, while prefixing namespaces with a unique name may sound simple. You have to be aware of the impact especially on code library's (like Printer.DLL) that other projects reference.
Community
  • 1
  • 1
Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321