"Value does not fall within the expected range" when trying to add a reference in a project

Tony_Henrich picture Tony_Henrich · May 28, 2014 · Viewed 64.7k times · Source

Suddenly I am getting this error "Value does not fall within the expected range" whenever I try to add a reference to any project. This also happens with a new blank project. It can list the current references fine.

I rebooted the computer. I am not sure if the recent Update 2 caused this. This is my first add reference since the update. I am using Visual Studio 2013 on Windows 7 64bit.

Any ideas?

enter image description here

Answer

Tony_Henrich picture Tony_Henrich · May 28, 2014

I did a 'devenv /setup' and that fixed it.

Detail

  • Exit Visual Studio
  • Click Start
  • Type cmd, right click Command Prompt and select Run as administrator
  • Navigate to the appropriate Visual Studio folder
    VS2012: pushd %programfiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE
    VS2015: pushd %programfiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE
    VS2017: pushd %programfiles(x86)%\Microsoft Visual Studio\2017\<Edition>\Common7\IDE
    VS2019: pushd %programfiles(x86)%\Microsoft Visual Studio\2019\<Edition>\Common7\IDE

  • Type devenv /setup and press enter

  • When the command prompt returns, you're done. Close the command window, reopen Visual Studio, and test to see if the error's resolved.

More Information

https://msdn.microsoft.com/en-us/library/ex6a2fad.aspx