How do I get matlab to recognize .net dll

3 views (last 30 days)
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)

Accepted Answer

Steven
Steven on 20 Apr 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

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!