Global.Micrsoft.VVisualBasic.ApplicationsServices..未定义错误BC30



我正在将一些旧的遗留VB应用程序从.NET框架转换到.NET 5,并且已经解决了大多数问题,但是,我迷失在以下方面:

Error   BC30002 Type 'Global.Microsoft.VisualBasic.ApplicationServices.ApplicationBase' is not defined.
Error   BC30002 Type 'Global.Microsoft.VisualBasic.ApplicationServices.User' is not defined.
Error   BC30002 Type 'Global.Microsoft.VisualBasic.Devices.Computer' is not defined.
Error   BC30002 Type 'Global.Microsoft.VisualBasic.MyServices.Internal.ContextValue' is not defined.

VisualBasic 10.3.0包包含在该项目中。

任何提示都将不胜感激。

谢谢,票据

我今天遇到了同样的问题,试图使用微软的升级助手将.net框架(4.6,但我想它通常适用于4.x(更新到.net 5。

我在github上的这个错误报告中找到了解决方案:

简单地说,将以下内容添加到新创建的.vbproj-file:中

<PropertyGroup>
<MyType>Empty</MyType>
</PropertyGroup>

放置在.vbproj-file的末尾,刚好位于</Project>结束标记之前。

我注意到,到目前为止提供的答案只提供了解决此问题的方法,而不是解决其根本原因。如果您在将传统VB项目升级到.Net Core/.Net框架时遇到BC30002错误,我建议在<PropertyGroup>中添加<UseWindowsForms>true</UseWindowsForms>,如下所示:

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Platforms>x64</Platforms>
<UseWindowsForms>true</UseWindowsForms>
<MyType>Windows</MyType>
</PropertyGroup>

最新更新