dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.19k stars 4.72k forks source link

Unable to use the package on Linux (Ubuntu) running .Net Core 5.0 #52570

Closed red4cape closed 3 years ago

red4cape commented 3 years ago

I have been getting the below error while trying to start my application on Ubuntu 20.04, with .Net 5.0 installed.

An assembly specified in the application dependencies manifest (Entry.deps.json) was not found: package: 'System.Drawing.Common', version: '5.0.2' path: 'runtimes/unix/lib/netcoreapp3.0/System.Drawing.Common.dll'

The project builds and runs without any errors on Mac OSx... However when I publish the Release to Ubuntu, I get the above error.

Note: I am using package Svg version 3.2.3, which is dependent on System.Drawing.Common.

I have already tried adding "System.Drawing.Common" nuget to the project but no luck. Any help is appreciated.

ghost commented 3 years ago

Tagging subscribers to this area: @safern, @tarekgh See info in area-owners.md if you want to be subscribed.

Issue Details
I have been getting the below error while trying to start my application on Ubuntu 20.04, with .Net 5.0 installed. An assembly specified in the application dependencies manifest (Entry.deps.json) was not found: package: 'System.Drawing.Common', version: '5.0.2' path: 'runtimes/unix/lib/netcoreapp3.0/System.Drawing.Common.dll' The project builds and runs without any errors on Mac OSx... However when I publish the Release to Ubuntu, I get the above error. Note: I am using package Svg version 3.2.3, which is dependent on System.Drawing.Common. I have already tried adding "System.Drawing.Common" nuget to the project but no luck. Any help is appreciated.
Author: red4cape
Assignees: -
Labels: `area-System.Drawing`, `untriaged`
Milestone: -
safern commented 3 years ago

@red4cape, so to understand correctly, you are building on OSX and then trying to deploy to your Ubuntu machine? How are you building/deploying the app?

Could you provide a small example app and some steps to reproduce?

red4cape commented 3 years ago

I develop using Visual Studio for Mac (not VS Code).

Steps to reproduce:

  1. Create Console application. Choose .Net 5.0
  2. Install the Official Svg Nuget
  3. Write any simple Svg Load code. (Sample code provided at the bottom).
  4. Build
  5. Publish to local file system from Visual Studio
  6. Copy the Published folder to Ubuntu 20.04 VM/baremetal [Note: Ubuntu already has dotnet installed following Ubuntu Dotnet Installation]
  7. Run the binary as > ./Entry.dll [Note: I named my console app "Entry"]
  8. You would get the below error. An assembly specified in the application dependencies manifest (Entry.deps.json) was not found: package: 'System.Drawing.Common', version: '5.0.2' path: 'runtimes/unix/lib/netcoreapp3.0/System.Drawing.Common.dll'

Sample code to add in program.cs Main(): var path = "/local/path/file.svg"; var pngPath = "/local/path/converted.png"; var svgDocument = SvgDocument.Open<SvgDocument>(path); var bitmap = svgDocument.Draw(); bitmap.Save(pngPath, ImageFormat.Png);

PS: System.Drawing.Common only is the dependency causing these issues. I have used various Azure .Net libraries such as Storage, Computer Vision etc; with no problems when deployed and ran on Ubuntu. Searching online, it appears there are a fair number of people who have been experiencing these problems with System.Drawing namespace.

red4cape commented 3 years ago

Added a symbolic link to "/usr/share/dotnet/shared/Microsoft.AspNetCore.App/5.0.5" from "runtimes/unix/lib/netcoreapp3.0". That fixed the problem. Good enough for now to unblock me.