Global.Micrsoft.VisualBasic.ApplicationsServices...未定义错误BC30002

问题描述 投票:0回答:3

我正在将一些旧的遗留 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包。

如有任何提示,我们将不胜感激。

谢谢, 比尔

vb.net .net-5 legacy-code
3个回答
16
投票

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

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

简单地说,将以下内容添加到您新创建的

.vbproj-file
中:

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

放置在

.vbproj-file
的末尾,就在
</Project>
结束标记之前。


5
投票

我注意到,到目前为止提供的答案仅提供了此问题的解决方法,而不是解决其根本原因。如果您在将旧版 VB 项目升级到 .NetCore/.Net 框架时遇到

BC30002
错误,我建议在
<UseWindowsForms>true</UseWindowsForms>
中添加
<PropertyGroup>
,如下所示:

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

0
投票

我在将 .Net FW 升级到 .Net 8 时遇到了同样的错误。项目的属性页有一个下拉菜单 - 选择“目标操作系统”为“Windows”,这会修改 .vbproj 文件你。

© www.soinside.com 2019 - 2024. All rights reserved.