视觉工作室。代码更改没有任何作用
我对代码所做的任何更改都没有任何作用。我什至尝试过添加一些我知道会使我的程序崩溃的行,但什么也没有。它只是继续运行旧版本。它甚至加载我编辑和保存的文件的旧版本。
我的解决方案中有 3 个项目。 2 是纯 C#。 1 是一个WinForms 应用程序。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(14)
有时会发生某些文件“正在被另一个进程使用”的情况。
关闭解决方案并删除解决方案中包含的所有项目的所有“bin”和“obj”子文件夹。
然后再次打开您的解决方案,执行“清理解决方案”并再次构建它。
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.
在“工具/选项”中检查此设置,然后在“项目和解决方案”>“构建并运行”下检查。
运行时,当发生构建或部署错误时:
我个人偏好将此值设置为“不启动”。它将阻止 Visual Studio 启动“上次成功的构建”。
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".
尝试 Ctrl+Shift+B。这将构建您的解决方案(不仅仅是一个特定的项目)。保存时可能会构建其他环境,但这需要在 Visual Studio 中明确显示。
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.
在 VS2017 (mac) Version 7.3 Preview (7.3 build 740) 上保存代码更改时出现问题,
保存文件更改的唯一方法是执行 File >保存全部
执行“文件”>“保存”就像保存文件一样。但是,当我再次打开该文件时,没有保存任何更改。
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.
好的,您需要添加更多详细信息,但您可能想看看这个答案:
如何在 Visual Studio 中启用/禁用编译错误警告
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
中删除已发布的 DLL
从 Bin文件名
-删除这两个文件并运行项目
delete Published DLL From Bin
file names -
delete these two files and run project
我遇到了同样的问题(Visual studio 2015 没有注意到我在 C# XAML 文件中的修改)。
通过删除 2 个“调试”子文件夹解决了问题。一份在 bin 文件夹中,一份在 obj 文件夹中。
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.
我遇到了同样的问题。代码更改未保存。(您可以从编辑中看到它是黄色的。例如表示更改)。 SAVE 和 BUILD 不会让它保存更改。我必须等待一段时间,然后它可能会挽救成功..
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..
从本地删除整个项目和相应的文件夹,然后再次查看解决方案。这对我有用=> VS2017
Deleting the whole project and the corresponding folder from local and check out the solution again. This worked for me=> VS2017
我这样解决了这个问题:
1.我关闭了程序
2. 我打开了包含该文件 (.csproj) 的文件夹,并使用 Visual Studio 将其打开。
接下来,我选择了运行命令的文件夹,如图所示
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
有同样的问题。原来我移动了一个项目文件夹。即使从移动的文件夹中打开解决方案并编辑和保存此源代码,VS 2019 也会构建并运行具有相同名称的程序的不同实例。转到文件->将 yourproject.cs 保存为..并手动返回目录结构以查找 VS 实际运行的实例。希望这有帮助。
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.
还要检查“工具”>“构建和运行”>“仅构建启动项目”中的另一个选项如果您有超过 1 个嵌套依赖项,尤其是在使用 Prism 或任何其他阻止“依赖项检测”的基于反射的框架时。另外,请确保在使用 Ctrl+S(保存)或 Ctrl+ShiftCtrl+Shift 等快捷键时位于编辑器中kbd>+S(全部保存)
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)
转到此位置:
然后删除所有文件并启动 Visual Studio。
Go to this location:
Then remove all files and start Visual Studio.
这是错误,构建后没有进行任何更改。
this was the error , no changes made after build.