BepInEx / BepInEx.AssemblyPublicizer

MIT License
64 stars 11 forks source link

Error MSB4018: The "PublicizeTask" task failed unexpectedly. Could not load file System.Text.Json #10

Closed MSchmoecker closed 7 months ago

MSchmoecker commented 10 months ago

While trying to switch to this package, an error is thrown:

/home/runner/.nuget/packages/bepinex.assemblypublicizer.msbuild/0.4.1/build/BepInEx.AssemblyPublicizer.MSBuild.props(11,9): error MSB4018: The "PublicizeTask" task failed unexpectedly. [/home/runner/work/Jotunn/Jotunn/JotunnLib/JotunnLib.csproj] /home/runner/.nuget/packages/bepinex.assemblypublicizer.msbuild/0.4.1/build/BepInEx.AssemblyPublicizer.MSBuild.props(11,9): error MSB4018: System.TypeLoadException: Could not load type of field 'AsmResolver.DotNet.Config.Json.RuntimeOptions:k__BackingField' (0) due to: Could not load file or assembly 'System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. [/home/runner/work/Jotunn/Jotunn/JotunnLib/JotunnLib.csproj]

The full log can be seen here.

What I already tried:

Any insight would be great, this publicizer would make the development much more seemless.

js6pak commented 8 months ago

This is likely the same issue as #11, could you try switching to the modern SDK-style project format?

MSchmoecker commented 7 months ago

The main project is using the SDK style project https://github.com/MSchmoecker/Jotunn/blob/dev/JotunnLib/JotunnLib.csproj and the project compiles locally without any issues.

Two projects inside the solution were using the legacy csproj format. However, even after removing all other project from the solution and updating to 0.4.2, the same error occurs https://github.com/MSchmoecker/Jotunn/actions/runs/8375446996/job/22932800248

js6pak commented 7 months ago

You are calling msbuild on linux which is aliased to mono's xbuild which has been dead for a very long time, it's surprising that it runs with the new project format at all. You shouldn't call the nuget executable for the same reason either. You should just use dotnet build -c Release instead, which uses the modern msbuild from the .NET (Core) SDK.

On a second look, do you need mono at all in your workflow?

MSchmoecker commented 7 months ago

Thanks a lot, dotnet build works!

Mono is probably a leftover from the time when the project used MMHOOK instead of Harmony.