Error switching the .NET Framework Error using dotnetenv

17 ビュー (過去 30 日間)
Christian Bothe
Christian Bothe 2025 年 9 月 14 日
回答済み: Aditya 2025 年 9 月 24 日
The framework is already loaded immediately after restarting Matlab 2025a.
Error using dotnetenv
.NET is loaded. To change the environment, restart MATLAB then call dotnetenv.
Restarting does not help
How can I prevent this?
asmList = System.AppDomain.CurrentDomain.GetAssemblies;
for k = 1:asmList.Length
disp(string(asmList(k).FullName))
end
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
dotnetcli, Version=1.0.9264.2405, Culture=neutral, PublicKeyToken=null
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
What I have already tested:
matlab -nojvm -singleCompThread -nodesktop

採用された回答

Aditya
Aditya 2025 年 9 月 24 日
Hi Christian,
In MATLAB R2025a, the .NET Framework is automatically loaded as soon as MATLAB starts, which is a change from previous versions. This means that when you try to use the dotnetenv function to change the .NET environment, MATLAB gives an error because the .NET runtime is already loaded and cannot be reconfigured in the current session. Restarting MATLAB does not resolve the issue, as the framework is loaded immediately upon launch—often due to internal MathWorks components or installed toolboxes that require .NET. Unfortunately, in recent MATLAB versions, there is no supported way to fully prevent .NET from loading at startup. The best approach is to check for any custom startup scripts or third-party toolboxes that might trigger .NET loading, but even with these removed, core MATLAB components may still load .NET automatically. For users who need precise control over the .NET environment, the only effective solution is to contact MathWorks support and explain the workflow, as this is a known limitation in newer MATLAB releases.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Microsoft .NET についてさらに検索

タグ

製品


リリース

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by