How do I get matlab to recognize .net dll

3 vues (au cours des 30 derniers jours)
Steven
Steven le 12 Fév 2016
Réponse apportée : Steven le 20 Avr 2016
I am trying to access a method in a .net class that opens a file then spits out data. You put the filename in and it gives you data out. I shouldn't have to register this dll with the gac. Why does matlab not load the dll? This is the error:
Error using FileScanner (line 12)
Message: Unable to find assembly 'InstData, Version=1.0.23.0, Culture=neutral, PublicKeyToken=null'.
Source: mscorlib
%**********************.Net Code:%**********************
using System;
namespace CSC.InstData {
static public InstData Open(String filename) {
InstData dataSet = new InstData();
return dataSet;
}
}
}
%**********************Matlab Code:%**********************
dllPath = fullfile(cd,'InstData.dll');
asm = NET.addAssembly(dllPath);
nfile = 'blah.datafile';
nfilePath = fullfile(cd,nfile);
InstClassdata = CSC.InstData.InstData.Open(nfilePath)

Réponse acceptée

Steven
Steven le 20 Avr 2016
You have to register the dll with the gacutil provided with visual studio, the best way to run it is through the visual studio developer command line. The dll will have to have a strong name (this can be added by reccompiling the dll, or you can generate your own if you can dissasemble it and reassemble it, there are instructions to do this). Then you can add the dll to the global cache with this command gacutil /i C:\Windows\somethign\somethgin.dll

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by