Untitled

Random thoughts about everything and nothing

How to: Manually update references in your Visual Studio projects

with 5 comments

It’s probably me…

but when I replace an existing reference (and i mean a none project reference), the new version isn’t (always) used at runtime.  Visual Studio 2005 displays the correct version number in the property pane, but the older version keeps popping up.

This behavior usually occurs when I follow this procedure.

  1. I remove the existing reference
  2. and re-add it through Add Reference

(even tried the Clean Solution option that’s available when you right-click on the solution file )

How to solve this…

When I can’t get rid of the behavior, I modify the references manually.

  1. In the solution explorer, right-click the project where you want to update the reference, and then click Unload project 
    Unload project - step 1
    The project will unload itself and the solution explorer will display a grey-ish variant of the project instance.
  2. In the solution explorer, right-click the unloaded project, and then click Edit <project>.xxproj
    Edit project
    An editor will appear displaying the xml content of the select project.
  3. Locate the reference you want to update in the editor.  The references can be found under ItemGroup | Reference.
    Reference in XML
    Change the version number in the Include attribute.
  4. (Optional) If you want, change the other elements / attributes (the xml intellisense feature in VS 2005 rocks!).
    Changed version
  5. Next, save the file.  In the solution explorer, right-click the project, and click Reload Project.
    Reload project
    If asked to close the previously file, press Yes
  6. We’re done 🙂

This procedure should work in Visual Studio 2003 (and Orcas[?]) as well…

Did you know?

In Visual Studio 2005 you have the option to unload and reload all projects under a project folder. 

  1. In the solution explorer, right-click on the project folder
  2. Press the Unload | Reload Projects in the Solution Folder option

Unload projects 

Advertisements

Written by Michael

August 1, 2007 at 1:24 pm

Posted in .NET, how to, Visual Studio, VSTS

5 Responses

Subscribe to comments with RSS.

  1. It is confusing and misleading when you say project folder when you are talking about solution folder.

    amitn

    January 9, 2009 at 10:31 pm

  2. […] While on the hunt to figure out why CheckedListBox is unavailable in my Smart Device project in Visual Studio 2008 Professional I came across this useful article about manually updating references. […]

  3. Hello webmaster
    I would like to share with you a link to your site
    write me here preonrelt@mail.ru

    Alexwebmaster

    March 3, 2009 at 1:44 pm

  4. Do anybody know how to reload the entire solution without closing and opening it again. ?

    vipin cheriyanveetil

    September 10, 2009 at 8:26 am

  5. Thank you! What’s with these people? VS2005 generates an obscure error (warning MSB3288) if you have two references to the same control with different versions in each reference (A situation I ‘effortlessly’ (i.e. without trying) created with an ActiveX control I am testing.) The error message gives not the slightest clue what to do. VS will display the version (so you can see the problem) but it is a *non-editable field*. And there is no command like “update this reference”. Sheesh. Can’t thank you enough for posting this somewhere Google could find it!

    Spike

    October 23, 2009 at 9:11 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: