Discord.Net icon indicating copy to clipboard operation
Discord.Net copied to clipboard

[Bug]: Issue when using NuGet for self-contained app (only for d.net 3.6.1)

Open joker-119 opened this issue 3 years ago • 2 comments

Check The Docs

  • [X] I double checked the docs and couldn't find any useful information.

Verify Issue Source

  • [X] I verified the issue was caused by Discord.Net.

Check your intents

  • [X] I double checked that I have the required intents.

Description

To build my bot, I am using dotnet publish -r linux-x64 -c Release -p:PublishReadyToRun=true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained true

When using the d.net 3.3.0, 3.4.0 or 3.5.0 versions from NuGet, this works fine, I get a single self-contained executable that runs without issue.

However when I update the NuGet package to 3.6.1, it builds fine, but when I run it, I am greeted with a System.IO exception instead.

Version

3.6.1

Working Version

3.5.0

Logs

Unhandled exception. System.IO.FileLoadException: Could not load file or assembly 'Discord.Net.Core, Version=3.6.1.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (0x80131040) File name: 'Discord.Net.Core, Version=3.6.1.0, Culture=neutral, PublicKeyToken=null' at BLART.Bot.Init(String[] args) at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at BLART.Bot.Init(String[] args) at BLART.Bot..ctor(String[] args) at BLART.Program.Main(String[] args) Aborted

Sample

https://github.com/Exiled-Team/BLART/blob/master/BLART/Bot.cs#L38

Packages

Discord.Net 3.6.1 Microsoft.Data.Sqlite 7.0.0-preview.2.22153.1 Newtonsoft.Json 13.0.1

joker-119 avatar May 04 '22 23:05 joker-119

Does this persist in 3.7.x?

csmir avatar Aug 01 '22 16:08 csmir

It does not, mewdeko is packaged as self contained and doesn't have this issue

SylveonDeko avatar Aug 01 '22 16:08 SylveonDeko