Efferent-Health / fo-dicom.Codecs

Cross-platform Dicom native codecs for fo-dicom
Other
65 stars 23 forks source link

Publish to single-file win-x64 does not copy Dicom.Native.dll #46

Closed pdgmdm closed 1 year ago

pdgmdm commented 1 year ago

Publish to single-file win-x64 does not copy Dicom.Native.dll.

Manually copying the file from bin\Release\net7.0\runtimes\win-x64\native to the publish output folder is required for the application to work correctly.

cbeltran1306 commented 1 year ago

Hello @pdgmdm, can you send us your source code of your project, please?

pdgmdm commented 1 year ago

Hi, please find attached a sample app which shows the issue. This is a console app, which is linked to a class library, which uses the dicom libs. When publishing the console app as a single file, the Dicom.Native.dll is not copied.

When running the application, this is the output:

Unhandled exception. System.DIlNotFoundException: Dil was not found

After manually coping the dll to the folder, all works fine.

ConsoleApp1.zip

jaime-olivares commented 1 year ago

Hi @pdgmdm, We have tested your sample app as a regular project. There are not problems. We don't have direct support for self-contained builds. Therefore, you have to take care of the directives for copying the required files. I guess you will require either <CopyToOutputDirectory> or <CopyToPublishDirectory> in your csproj file.

pdgmdm commented 1 year ago

Hello @jaime-olivares , Thanks for this information. I will manually copy the DLL.

However, for future releases, perhaps have a look at https://www.nuget.org/packages/Magick.NET-Q16-AnyCPU , for that package, the DLL is copied correctly also for single file publishes.