How do I get matlab to recognize .net dll

조회 수: 3 (최근 30일)
Steven
Steven 2016년 2월 12일
답변: Steven 2016년 4월 20일
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)

채택된 답변

Steven
Steven 2016년 4월 20일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by