Remove Assembly that was loaded with addAssembly

15 ビュー (過去 30 日間)
Romaine Carter
Romaine Carter 2014 年 3 月 28 日
コメント済み: KAE 2022 年 4 月 18 日
How do I remove an assembly that was loaded with addAssembly?
Situation: I installed an assembly in the GAC and loaded it into MATLAB. now im doing some integration tests with the same dll but loaded from a different place in the file system and MATLAB is giving me a warning and i cannot step into the dll source.
CODE:
NET.addAssembly('C:\foo\foo.dll');
Warning: Assembly C:\Windows\Microsoft.Net\assembly\GAC_MSIL\foo\v4.0_1.0.0.0__772795e52c232a80\foo.dll' has already been added from location 'foo'
How do i get fix this? I have already removed dll from GAC
  2 件のコメント
Doctor G
Doctor G 2017 年 10 月 19 日
The documentation says you cannot unload. I end up restarting matlab each time.
KAE
KAE 2022 年 4 月 18 日
Can I just ignore this warning?

サインインしてコメントする。

回答 (1 件)

Hossam Alzomor
Hossam Alzomor 2022 年 3 月 17 日
you can asign the result of add assembly to variable and check for it before adding the assembly
if isempty(which('asm'))
asm = NET.addAssembly('C:\foo\foo.dll');
end
  1 件のコメント
KAE
KAE 2022 年 4 月 18 日
I still get the following error when I add the isempty call
Warning: Assembly 'xx' has already been added from location 'C:\Users\yy\zz.dll'.
because
isempty(which('asm'))
is true.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by