Visual Studio. Code changes don't do anything

蹲街弑〆低调 提交于 2019-12-18 04:47:07

问题


Any changes I make to my code aren't doing anything. I've even tried putting lines in that I know will crash my program, and nothing. It just keep running the old version. It's even loading old versions of files I've edited and saved.

There a 3 projects in my solution. 2 are pure C#. 1 is a WinForms application.


回答1:


It sometimes happens that some files "are being used by another process".

Close your solution and delete all "bin" and "obj" subfolders of all your projects that are included in the solution.

Then open your solution again, execute "Clean solution" and build it again.




回答2:


Check this setting in Tools/Options, then under Projects and Solutions>Build and Run.

On Run, when build or deployment errors occur:

My personal preference is for this value to be 'Do not launch'. It will prevent Visual Studio from launching the "last successful build".




回答3:


Try Ctrl+Shift+B. This will build your solution (not just a particular project). Other environments might build when you save but this needs to be explicit in Visual Studio.




回答4:


Had issue with saving code changes on VS2017 (mac) Version 7.3 Preview (7.3 build 740)

Only way to get file changes to save was to do File > Save All

Doing File>Save would act like the file saved. But, when I opened the file again and no changes were saved.




回答5:


Ok, you need to add more detail, but you may want to have a look at this answer:

How to enable/disable compile errors warning in Visual Studio




回答6:


delete Published DLL From Bin

file names -

projectName.ddl
projectName.pdb

delete these two files and run project




回答7:


I had the same problem (Visual studio 2015 is not noticing my modifications in C# XAML files).

Problem solved by deleting 2 'debug' subfolders. One in the bin folder and one in the obj folder.




回答8:


I met the same problem. the code changes is not saved.(you can see from the edit it is in Yellow color. e.g. indicating changes). SAVE and BUILD will not let it save the changes. i have to wait sometime, then it could possibly save success..




回答9:


Deleting the whole project and the corresponding folder from local and check out the solution again. This worked for me=> VS2017




回答10:


I solved the problem like this:

1. I closed the program

2. I opened the folder that contains the file (.csproj) and opened it with Visual Studio.

Next, I chose the folder to run the command as in the image




回答11:


Had the same problem. Turns out I had moved a project folder. Even when opening the solution from the moved folder and editing and saving this source code, VS 2019 was building and running a different instance of the program with the same name. Go to File-> Save yourproject.cs as..and manually walk back through the directory structure to find the instance VS is actually running. Hope this helps.




回答12:


also check another option in Tools>Build and Run>Only build startup project & dependencies if you have more than 1 nested dependency, especially when using Prism or any other reflection-based frameworks that prevent "dependency detection". Also, make sure you're in the editor when using shortcuts like Ctrl+S (Save) or Ctrl+Shift+S (Save all)



来源:https://stackoverflow.com/questions/6077899/visual-studio-code-changes-dont-do-anything

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!