Visual Studio locking files while debugging

前端 未结 3 977
慢半拍i
慢半拍i 2021-01-11 15:44

I have a VS solution containing several projects. While debugging a particular project all the source files are locked by VS. I would like to unlock sources that the debugee

相关标签:
3条回答
  • 2021-01-11 16:18

    This doesn't quite answer the OP's question per se, but for anyone who has stumbled upon this page in the same (very frustrated) boat as I am, this might help.

    The solution: start without debugging.

    It was driving me absolutely crazy that Visual Studio would not let me edit files while the app was running. My typical workflow is:

    1. Make some changes
    2. Run the app to see the effects of those changes
    3. Based on the results, make more changes, etc. etc.

    The problem is Visual Studio was preventing me from step 3. It demands that you STOP running the app before you can even make any changes (including to a XAML file or adding a file to the project), which also means that you can't go back to the app to double-check something while you are actually programming it at the same time (which is how I work, bro).

    Thank god I finally discovered if I run without debugging it doesn't impose this ridiculous limitation. It's still a pain in the butt if you actually need to debug something you have to re-run the app in debug mode, but it sure beats having to kill the app before it will even let you edit a file.

    0 讨论(0)
  • 2021-01-11 16:23

    The Edit and Continue feature is preventing you from editing files if the debugger hasn't stopped the program. The simple workaround is Debug + Break All, you should then be able to edit the files, your changes will be immediately effective provided your changes do not violate the restrictions imposed by E+C. This is the most efficient work flow.

    The heavy-handed approach is to disable Edit and Continue. Tools + Options, Debugger, Edit and Continue, uncheck the Enable check box.

    0 讨论(0)
  • 2021-01-11 16:26

    I don't think that there is a way to avoid that. While debugging Visual Studio lock all files to prevent any change on them, including those on other projects.
    You can try to open the project which you are interested on with another Visual Studio instance to make changes to your files or open files singularly with another editor.

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