visual-studio 在设计器模式下打开 .NET 表单 - 获取“路径不是合法形式”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/80234/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Open .NET form in designer mode - get "The path is not of a legal form"
提问by Shaul Behr
I attempted to open a C#/VB form in designer mode, and instead of the form, I got an ugly error message saying "The path is not of a legal form". This form used to work! What happened?
我试图在设计器模式下打开一个 C#/VB 表单,但我收到一条丑陋的错误消息,说“路径不是合法形式”,而不是该表单。这种形式曾经有效!发生了什么?
Thanks to all who have answered. This question is a problem I hit a while back, and I struggled with it for a long time, until I found the answer, which I posted below in order to help other people who might have hit this problem.
Thanks!
感谢所有回答的人。这个问题是我不久前遇到的一个问题,我挣扎了很长时间,直到找到答案,我在下面发布了答案,以帮助可能遇到此问题的其他人。
谢谢!
回答by Shaul Behr
I don't know what this error message means, but it seems to be associated with third-party controls on the form. Anyway, the solution is almost as absurd as the problem:
我不知道这个错误信息是什么意思,但它似乎与表单上的第三方控件有关。无论如何,解决方案几乎和问题一样荒谬:
- Close the designer/error message.
- Open the form code.
- Right-click on the form code and select "View Designer".
- 关闭设计器/错误消息。
- 打开表单代码。
- 右键单击表单代码并选择“视图设计器”。
Presto! The designer opens!
快!设计师开门!
回答by jfs
Debugging design mode would help. From here:
调试设计模式会有所帮助。从这里:
- List item
- In visual studio, select the project you want to debug.
- Right click -> Properties.
- Select the debugging tab.
- Change the debug mode to Program.
- Set the “Start Application” to be your visual studio IDE (C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe)
- Set your solution file in the “command line argument field”.
- Apply -> OK
- Select the project you want to debug as the startup project.
- Run.
- Set a break point in the place you want to start debug (for example, your control constructor)
- 项目清单
- 在visual studio中,选择要调试的项目。
- 右键单击-> 属性。
- 选择调试选项卡。
- 将调试模式更改为程序。
- 将“启动应用程序”设置为你的 Visual Studio IDE (C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe)
- 在“命令行参数字段”中设置您的解决方案文件。
- 申请 -> 确定
- 选择要调试的项目作为启动项目。
- 跑。
- 在要开始调试的地方设置断点(例如,您的控件构造函数)
回答by Michel
This problem happened with me, and I found out it is because of bad reference. You have to review the assemblies that your application references.
这个问题发生在我身上,我发现这是因为参考不好。您必须查看应用程序引用的程序集。
回答by David Ackerman
By path, it might be referring to a path to a file or folder. There could be a malformed path that you are trying to reference, i.e. forward slash instead of backslash. Also, what changed since the error came up? Did you move any files around? Did you save any previously unsaved code? Update from a version control system?
通过路径,它可能指的是文件或文件夹的路径。可能存在您试图引用的格式错误的路径,即正斜杠而不是反斜杠。另外,自从出现错误以来发生了什么变化?你有没有移动任何文件?您是否保存了任何以前未保存的代码?从版本控制系统更新?

