简体   繁体   English

VB.NET:错误BC30037,后跟错误BC30627和错误BC30465

[英]VB.NET: error BC30037, followed by error BC30627 and error BC30465

I'm getting these errors:我收到这些错误:

AnonymousPath\Anonymized.vb : error BC30037: Character is not valid.
AnonymousPath\Anonymized.vb(2) : error BC30627: 'Option' statements must precede any declarations or 'Imports' statements.
AnonymousPath\Anonymized.vb(4) : error BC30465: 'Imports' statements must precede any declarations.

I get as many error BC30465's as Imports我收到与 Imports 一样多的错误 BC30465

Here's the (anonymized) code the errors point to:这是错误指向的(匿名)代码:

Option Strict On
Option Explicit On

Imports System.Data.Common
'More Imports

I tried cleaning the solution an building again and closing VS2010 and opening it again, and I still get this.我尝试再次清理解决方案并关闭 VS2010 并再次打开它,但我仍然得到这个。 I should mention that our solution has VB.NET projects, C# projects and C++/CLI /clr projects that act as wrapper for unmanaged C++ projects.我应该提到,我们的解决方案有 VB.NET 项目、C# 项目和 C++/CLI /clr 项目,它们充当非托管 C++ 项目的包装器。 We are slooowly migrating the VB.NET code to C#, that might be related to this issue.我们正在慢慢将 VB.NET 代码迁移到 C#,这可能与此问题有关。 Any clues?有什么线索吗? This might have to do with a cyclic import or something.这可能与循环导入或其他东西有关。

Perhaps help you.或许能帮到你。 Review your Framework versions in your solution or projects.查看解决方案或项目中的框架版本。 In my case, I changed the Framework versions and resolved.就我而言,我更改了框架版本并解决了。 For example, I changed Framework 4.5.1 by the Framework version 4.5.例如,我将 Framework 4.5.1 更改为 Framework 版本 4.5。 I haven't trouble now.我现在没有麻烦。 Of course, this work I maked for WinForm type projects.当然,我为 WinForm 类型的项目所做的这项工作。 I hope you can resolved quickly.我希望你能尽快解决。

My bad, there REALLY was a bogus character (a space) before the first Option keyword.我的错,在第一个 Option 关键字之前确实有一个假字符(空格)。 I saw it with Notepad++, activating the 'view whitespace' option.我用 Notepad++ 看到了它,激活了“查看空白”选项。 My sight is not what is used to be, damn the PS2.我的视线已经不是以前的样子了,该死的 PS2。 I deleted it using Notepad++, reloaded it in Visual Studio, and away they went those errors.我使用 Notepad++ 删除了它,在 Visual Studio 中重新加载它,然后他们就解决了这些错误。

However, VS2010 never showed me that space, so he must have a bug.但是,VS2010 从来没有向我展示过那个空间,所以他一定有一个错误。 I hope it's just VB.NET related...我希望它只是 VB.NET 相关的......

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

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