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

后端 未结 9 571
栀梦
栀梦 2020-12-02 16:31

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 proje

相关标签:
9条回答
  • 2020-12-02 17:10

    I just had the same, it was only one file which casing this issue, When I read the solution above I was worried to fix all visual studio because one .cs file so I tried to right click on the (TAB header) beside the (X) button which closes this and click on (Close All documents)...

    it worked : )

    0 讨论(0)
  • 2020-12-02 17:15

    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)

    0 讨论(0)
  • 2020-12-02 17:16

    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.

    0 讨论(0)
  • 2020-12-02 17:16

    In my case it was simple, if the file is open and then I run it, it will run. If the file is closed and then I run it by right clicking from the "Solution Explorer", then it throws the error you mentioned. So, simple steps: In the Solution Explorer,

    1. Double click on the file and open it
    2. Right click on the file and select "Start with Debugging" or "Start without Debugging"
    0 讨论(0)
  • 2020-12-02 17:23

    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.

    0 讨论(0)
  • 2020-12-02 17:26

    I have seen this box in VS-2019 16.5.4 in a Winforms/4.8 app with Std classlibs, on attempting to close one of the Winforms/4.8 source file tabs. The message came up, the tab refused to close.

    Solved it by closing an re-opening the Solution.

    0 讨论(0)
提交回复
热议问题