Skip to content

Generates invalid version number for BepInEx 5 (not tested on 6) with .NET SDK 8 or higher with default project configuration #4

@Hamunii

Description

@Hamunii

Breaking change: https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/source-link

The Source Link build tooling is now included in the .NET SDK. Source Link enables packages and applications to embed information about the source control information of the built artifacts. As a side effect, commit information is included in the InformationalVersion value of built libraries and applications.

As a result, BepInEx.AutoPlugin will generate a version that includes the git commit:

[BepInEx.BepInPlugin(Plugin.Id, "Example Plugin", "1.0.0+9cab2223d941379d728c5367550915362fb0601f")]
public partial class Plugin

However, this throws:

new Version("1.0.0+9cab2223d941379d728c5367550915362fb0601f");
// FormatException: Input string was not in a correct format.

And so the BepInPlugin's Version property remains null, and BepInEx won't load the plugin.

We can however get rid of the git commit with this and fix the issue (as the above link suggests):

<PropertyGroup>
  <IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>

However, generating an invalid version by default doesn't seem optimal.

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