Skip to content

Instantly share code, notes, and snippets.

View lvhkhanh's full-sized avatar
🌴
On vacation

KhanhLVH lvhkhanh

🌴
On vacation
View GitHub Profile
@lvhkhanh
lvhkhanh / ProjectMacros.vb
Created September 12, 2018 07:14 — forked from Benjol/ProjectMacros.vb
Project reference-fixing macros for Visual Studio
' These macros can be used to automatically swap between project and file references when adding/removing projects from a solution.
' When adding a new project to a solution, all the existing projects (and the new project) are scanned to see if there
' are existing file references to the project. If so, the file reference will be updated to a project reference.
' Conversely, when removing a project, if the macro can file a dll on the references path which has the same name as the removed
' project, it will change the project reference to a file reference.
' There are a few idiosyncrasies to be aware of: in my environment, all projects build to a common folder, so the macro will set references
' to 'No Copy', 'Any version', EXCEPT for 'Test' projects
' (Note that not all project types are supported)
' This code won't update a project when it is removed (impossible to save a project when it's already 'gone')