You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VB.NET浮动网络许可服务代码BC32035错误原因咨询

错误BC32035:Attribute specifier is not a complete statement的原因及解决方法

错误原因

在VB.NET中,属性声明的行续符(下划线_)必须直接衔接目标代码,不能单独占一行,也不能在续行符和目标代码之间留空行。你的代码里<RunInstaller(True)> _单独占了一行,后面空了一行才是Public Class ProjectInstaller,编译器无法识别这个属性是要应用到后续的ProjectInstaller类上,因此抛出该错误。

解决方法

有两种修正方式:

  1. 将属性与类定义放在同一行:
<RunInstaller(True)> Public Class ProjectInstaller
  1. 保留行续符,但确保续行符后直接衔接类定义,无空行:
<RunInstaller(True)> _
Public Class ProjectInstaller

修正后的完整ProjectInstaller代码

Imports System.ComponentModel
Imports System.Configuration.Install
Imports System.ServiceProcess

<RunInstaller(True)> _
Public Class ProjectInstaller
    Inherits Installer

    Private serviceInstaller As ServiceInstaller
    Private processInstaller As ServiceProcessInstaller

    Public Sub New()
        processInstaller = New ServiceProcessInstaller()
        serviceInstaller = New ServiceInstaller()

        ' 服务将在系统账户下运行
        processInstaller.Account = ServiceAccount.LocalSystem

        ' 服务信息配置
        serviceInstaller.DisplayName = "License Server Service"
        serviceInstaller.StartType = ServiceStartMode.Automatic
        serviceInstaller.ServiceName = "LicenseServerService"

        ' 将安装器添加到集合,顺序不影响
        Installers.Add(serviceInstaller)
        Installers.Add(processInstaller)
    End Sub
End Class

内容的提问来源于stack exchange,提问作者Graham

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 12:12:36