Ce billet est disponible en francais.

With more and more platforms appearing in the Microsoft landscape, multi-targeting is getting more and more common.

Multi-targeting is used when the Portable Libraries don't cut it. It's interesting when you're not in the mood of making too many abstractions to cope with missing classes and methods for your selected platforms intersection.

If you go with the multi-targeting, you've got multiple choices, such as using Project Linker, and create multiple projects for the same source files and link the files between your two projects.

At this point though, Project Linker does not support VS2012, so you're left with the Add as Link trick in Visual Studio, which does not support folders.

Well, in Visual Studio 2012, there a new feature that allows just that.


Here's what to do :

  • In your source project, select your files and folders to link to the other project
  • Drag then to the new location in the other project, but don't drop just yet
  • Hold Ctrl + Shift, then drop.


There you have it, a replica of your folders and files. You'll notice that folders are not links (folder links do not exist), but files are. Oh well, it's better that nothing !

You'll also notice that if you do the operation again, with new files or folders, only the new files and folders will be linked, and no error will be thrown because the other files or folders already exist.

Now you can multi-target your source files very easily with a drag and drop.

Not a ground breaking feature, but definitely another time saver !