Skip to content

Version 2.3.179 creates VB syntax error in ThisAssembly class #358

@mkaring

Description

@mkaring

The new version 2.3.179 creates invalid code for Visual Basic projects for the ThisAssembly class.

The produced code is the following:

<Assembly: System.Reflection.AssemblyVersionAttribute("…")>
<Assembly: System.Reflection.AssemblyFileVersionAttribute("…")>
<Assembly: System.Reflection.AssemblyInformationalVersionAttribute("…")>
#If NETSTANDARD Or NETFRAMEWORK Or NETCOREAPP Then
<System.CodeDom.Compiler.GeneratedCode("Nerdbank.GitVersioning.Tasks","2.3.179.31651")>
#End If
Partial Friend NotInheritable Class ThisAssemblyEnd Class

This is not valid in Visual Basic, because it's illegal for anything but more attributes to be written between the declaration of a type (or a member for that matter) and the attribute that will be applied to it. This includes the #End If instruction.

The only way to build what you did here as valid code is to include the declaration of the class in the header. Like so:

<Assembly: System.Reflection.AssemblyVersionAttribute("…")>
<Assembly: System.Reflection.AssemblyFileVersionAttribute("…")>
<Assembly: System.Reflection.AssemblyInformationalVersionAttribute("…")>
#If NETSTANDARD Or NETFRAMEWORK Or NETCOREAPP Then
<System.CodeDom.Compiler.GeneratedCode("Nerdbank.GitVersioning.Tasks","2.3.179.31651")>
Partial Friend NotInheritable Class ThisAssembly
#Else
Partial Friend NotInheritable Class ThisAssembly
#End IfEnd Class

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions