Effacer les filtres
Effacer les filtres

.NET Core does not support loading assemblies

9 vues (au cours des 30 derniers jours)
Thomas Stauffer
Thomas Stauffer le 18 Oct 2022
Commenté : Thomas Stauffer le 14 Sep 2023
We use MATLAB R2022b to access .NET 6 libraries. This works as long as the library does NOT reference some other assemblies in the cache. E.g. one of the .NET 6 libraries we use accesses System.IO.Ports (via official nuget package manager), this library then cannot be loaded in MATLAB R2022b as we get the following error then:
Message: Could not load file or assembly 'System.IO.Ports, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Is there a workaround, or is this something MATLAB will support in the future?
  3 commentaires
Henrik Teneberg
Henrik Teneberg le 14 Sep 2023
I am also affected by this. The obvious workaround is to set up a Publish Profile for your .NET project that has the flags:
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
<PublishTrimmed>false</PublishTrimmed>
This basically means shipping all .NET dlls with every deploy though.
I am also looking forward to a fix/comment from Mathworks.
Thomas Stauffer
Thomas Stauffer le 14 Sep 2023
I was not able to fix this. What is also somewhat cumbersome, that MATLAB not automatically can handle the case when the dll is updated, as this happens many times during development. What we did in the end was something else. Making a .NET application acting as a webservice and then using webread/webwrite from MATLAB. This also works then for older MATLAB version which have no .NET 6/7 support.

Connectez-vous pour commenter.

Réponses (0)

Tags

Produits


Version

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by