How do I get matlab to recognize .net dll

6 ビュー (過去 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 Center および File ExchangeGetting Started with Microsoft .NET についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by