简体   繁体   English

为什么 Visual Studio Code 运行旧代码?

[英]Why is Visual Studio Code Running Old Code?

I'm new to programming and have been practicing python for a few months now.我是编程新手,现在已经练习 python 几个月了。 One problem that I keep facing is when vscode executes old code.我一直面临的一个问题是 vscode 执行旧代码时。 I have autosave on and have tried closing the program and opening it again.我打开了自动保存,并尝试关闭程序并再次打开它。 Currently, I have a totally different file open and its showing me TypeError associated with another file I was working on yesterday.目前,我打开了一个完全不同的文件,它显示 TypeError 与我昨天正在处理的另一个文件相关联。 The file that I'm running works perfectly fine in other text editors.我正在运行的文件在其他文本编辑器中运行良好。 Thanks in advance!提前致谢!

From my experience, assuming you are using Run(Ctrl+F5 or F5) , you are probably building off an old project.根据我的经验,假设您使用的是Run(Ctrl+F5 or F5) ,您可能正在构建一个旧项目。 In Solution Explorer, when you choose or open the project/repository.在解决方案资源管理器中,当您选择或打开项目/存储库时。 It will run and build off of that project until you choose a new one.它将运行并构建该项目,直到您选择一个新项目。 Just opening another file in the same window/solution will not change the build path.仅在同一窗口/解决方案中打开另一个文件不会更改构建路径。

Another solution you could try is to execute the program file from cmd line in the terminal(ctrl + `) .您可以尝试的另一个解决方案是从terminal(ctrl + `)中的 cmd 行执行程序文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM