Skip to content

Unable to build single file executable

Summary

When building and packaging for .net 5 and using single file and self contained flags, the path to the native vlc library cannot be resolved.

Minimal project and steps to reproduce

  1. Create any .net 5+ console application with LibVLCSharp nuget package installed
  2. In main call Core.Initialize()
  3. Build and publish the console app using single file and self contained options: dotnet publish 'path/to.sln' -c release -r win-x64 --no-restore -p:PublishSingleFile=true --self-contained true -o 'build\win-x64'
  4. Run built executable
  5. See error

What is the current bug behavior?

image

What is the expected correct behavior?

Application should run with all dependencies built in, and resolve the correct path to the embedded libraries.

Does it work on other plaforms? Does it work with the official VLC apps?

no

Relevant logs and/or screenshots

image

Environment

  • OS: windows 10
  • Device: Windows 10 PC
  • LibVLCSharp version 3.5.0

Possible fixes

https://stackoverflow.com/a/62626131/2663813

Edited by RageAgainstThePixel
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information