简体   繁体   English

我重命名了表单并忘记保存 Visual Studio C# - 如何修复此错误?

[英]I renamed form and forgot to save visual studio C# - How do I fix this error?

I renamed a form and forgot to save my Visual Studio Project.我重命名了一个表单并忘记保存我的 Visual Studio 项目。 Now I am getting this error: The file does not support code parsing or generation because it is not contained within a project that supports code.现在我收到此错误: The file does not support code parsing or generation because it is not contained within a project that supports code.

I can still see the original form name and when I double click the specific form this is the error I get: the item does not exist it may have been moved, renamed, or deleted我仍然可以看到原始表单名称,当我双击特定表单时,这是我得到的错误: the item does not exist it may have been moved, renamed, or deleted

How do I fix my problem?如何解决我的问题? I just want access to the form I renamed and I am guessing the project is not reading for the new one (but unsaved) and is searching for the original which does not exist anymore.我只想访问我重命名的表单,我猜该项目没有读取新表单(但未保存),并且正在搜索不再存在的原始表单。

Solved this problem from @KingOfArrows 's comment, but I may as well post it here.从@KingOfArrows 的评论中解决了这个问题,但我不妨把它贴在这里。 I was able to solve the issue by editing every instance of the old version in the.csproj file by:我能够通过编辑 .csproj 文件中旧版本的每个实例来解决该问题:

  1. Right clicking on the project and selecting unload project in the solution viewer右键单击项目并在解决方案查看器中选择unload project
  2. Right clicking the project and clicking edit project file (if it hadn't already appeared automatically), and then changing every reference of the old name to the new name in the text右键单击项目并单击edit project file (如果它尚未自动出现),然后将旧名称的每个引用更改为文本中的新名称
  3. I closed out of the entire visual studio application and when I reopened it, I right clicked again the project in the solution viewer and clicked reload project , causing everything to work properly.我关闭了整个 Visual Studio 应用程序,当我重新打开它时,我再次右键单击解决方案查看器中的项目并单击reload project ,从而使一切正常工作。

I hope this helps anyone if they run into the same issue.如果遇到同样的问题,我希望这对任何人都有帮助。

暂无
暂无

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

相关问题 如何在 Visual Studio C# 中创建表单实例? - How do I create an instance of a form in Visual Studio C#? 初始化 C# Visual Studio Windows 窗体应用程序后,如何更改窗体的视觉效果? - How do I change the visual of a form after it has Initialized C# Visual Studio Windows Form App? 尝试通过C#从HTML访问上传的文件时,如何解决Visual Studio中的NullReference错误? - How do I fix NullReference error in visual studio when trying to accesses uploaded file from html via c#? 如何修复 Visual Studio 将 C# Unity 脚本视为杂项,因此无法自动完成? - How do I fix Visual Studio Treating C# Unity Scripts as Miscellaneous, and thus not autocompleting? 如何解决Visual Studio 2010 C#中的下一个错误? - How I can fix the next error in Visual Studio 2010 C#? C# Visual Studio 中出现关于转换的错误,我不知道如何修复 - An error in C# Visual Studio about conversions came up that I don't know how to fix Rhino Mocks和Visual Studio:如何解决此错误? - Rhino Mocks and Visual Studio: How do I fix this error? 如何设计看起来像Visual Studio错误列表的C#视觉主题 - How do I design a C# visual motif that looks like visual studio error list Visual Studio C#:将光标移动到导致内存不足的特定坐标时,更改窗体背景图像。 我该如何解决? - Visual Studio C#: Changing Form background image when moving cursor to a specific coordinate causing out of memory. How do I fix this? 如何将控制台应用程序中的变量值传递给 C# 中的 windows 表单应用程序(Visual Studio) - How do i pass a variable value from Console application to windows form application in C# (visual studio)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM