Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 780
Tony_Henrich Avatar asked May 28 '14 01:05

Tony_Henrich


5 Answers

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

like image 120
Tony_Henrich Avatar answered Nov 17 '22 09:11

Tony_Henrich


In my case, project was set to use local IIS (when the project set up to use local IIS but the app does not deployed there, it cannot load project but states clearly in the error message. However this time I was keep getting Value does not fall within the expected range with any other info.

Only "solution" worked for me was:

  • Edit csproj file
  • Set <UseIISExpress> to true
  • Set <UseIIS> to false
  • Then reload the project.

(after that you can set your local IIS again)

like image 35
curiousBoy Avatar answered Nov 17 '22 08:11

curiousBoy


In my case deleting .suo file in \.vs\[solutionName] folder fixed the problem in Visual Studio 2022

like image 10
Elvin Mammadov Avatar answered Nov 17 '22 09:11

Elvin Mammadov


Some projects (e.g. some web services) require that Visual Studio be run as an administrator. After a Visual Studio upgrade, I hadn't noticed that it was no longer being started with elevated privileges automatically. When I corrected this, all the projects in the solution loaded.

like image 9
Graham Laight Avatar answered Nov 17 '22 08:11

Graham Laight


In my case, this was because I needed a specific version of the .NET Core SDK installed.

Once I got it downloaded and installed, the projects loaded fine. Unfortunately there was no additional information in the Output tab hinting at this.

like image 2
emragins Avatar answered Nov 17 '22 08:11

emragins