Web developer from Sydney Australia. Currently using asp.net, mvc where possible.

Sunday, September 25, 2011

Project to File Reference Switcher for Visual Studio

Switching from project to file references in visual studio has always been a pain. Once you add a project to the solution you have to go find all the locations the assembly is referenced by file path and remove and update to a project reference.

On top of playing hide and seek with references, the actual act of changing references is a slow and painful experience.

So I decided to experiment and write my first visual studio extension, "Reference Switcher"

Once installed it will sit patiently in the background and only activate when you add or remove a project from the solution.

When you add a project, it gets the assembly name defined by the project and then checks to see if other projects in the solution are referencing that assembly name. If they do, it will open a alert box (sorry, send a push request) and ask if you would like to switch the file reference to a project reference. Just hit OK and it will go ahead and switch all the references for you.

When you remove a project, it all happens in reverse. So any project references that it changed are restored back to the original file based reference.

Here are some screen shots of the extension in action:

1) Adding a existing project (existing projects have a file references to this one)


2) Shows projects that can be updated to use a project reference


3) Now the references have changed to Project References



4) When the project is removed, Reference Switcher confirms before changing the references back to there original location


5)Now the reference has changed back to a file reference


That's all there is to it. Small & simply but very handy.

The extension source can be found on git hub here:
Extension can be found in the gallery here:

Shout it

kick it on DotNetKicks.com

8 comments:

Jason Irwin said...

Very neat - looking forward to giving this a shot!

Gatesben said...

well said...pointable...
Hire iPhone Developers

Michael Reichenauer said...

Very nice. Have been locking for something like this for years. It will really make developing much easier when including external modules.
Found minor problem: The extension seems to have problem detecting references in projects located within solution folders (i.e. not file folders). Moving the projects out of the folders makes the extension work as expected.

David bone said...

Took me time to read all the comments, but I really love the article. It proved to be very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also engaged! I’m sure you had joy writing this article.singapore hotel deals

seoinheritx said...

interesting article and impressive point of view, thanks

Ruby on Rails Development | Asp.net Development

malini ecorp said...

Ecorptrainings.com provides ASP.NET in hyderabad with best faculties on real time projects. We give the best online trainingamong the ASP.NET in Hyderabad. Classroom Training in Hyderabad India

Govind Sharma said...

I have known many information from this. i like this post.

Thanks for sharing.

Mechanical Seals

Matthias Muenzner said...

Nice program!!! Used it a lot!

Any plans on upgrading it to vs 2012?