Error switching the .NET Framework Error using dotnetenv

7 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Get 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