"Assembly with same name is already loaded" #21224
abbgrade
started this conversation in
Enhancements
Replies: 1 comment 4 replies
-
You'll want to have the module developers implement an Assembly Load Context for their dependencies so they are not loaded into the default. Here is a PowerShell talk on implementation: https://www.youtube.com/watch?v=KV3D2wP_Uug |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
maybe you know the problem already: if you use modules in a script, that rely on the same dotnet assembly, you will sooner or later get the error
Assembly with same name is already loaded
. Not always, since if both instances of the assembly are in the same version, it's fine. If not, then it depends on the order of loading the assemblies. If the newer version is loaded first, then it will work as well. If the older one is loaded first, you cannot import the second module.The longer you maintain the script, the higher the error probability becomes, since new versions of assemblies will be released and the modules may be updated. So the required order of loading the modules may change.
There are popular assemblies like
Microsoft.Identity.Client
,Azure.Identity
and some more that are used by many modules and tend to produce issues.Have you a workaround or solution for this, that you could share?
In general, I think this is a dotnet / powershell issue and should be fixed. But unfortunately I don't have a working solution approach.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions