Azure / Azure/azure-powershell
az.aks module assembly conflict with other modules because of YamlDotNet.dll
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
It seems like the az.aks module has a dependency on an old version of YamlDotNet.dll that can conflict and prevent the module to be imported.
Referring to this article https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/resolving-dependency-conflicts?view=powershell-7.3 and the bug I reported in the powershell-yaml module repo: https://github.com/cloudbase/powershell-yaml/issues/109 there should be workarounds to make the module more robust in handling the assembly conflict.
### Issue script & Debug output
```PowerShell
PowerShell 7.3.4
> get-module
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Manifest 7.0.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-It…
Script 2.2.6 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, …
> import-module powershell-yaml
> import-module az.aks
Import-Module: Assembly with same name is already loaded
> get-module
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 0.0 Load-Assemblies
Manifest 7.0.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-It…
Manifest 7.0.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Ob…
Script 0.4.7 powershell-yaml {ConvertFrom-Yaml, ConvertTo-Yaml, cfy, cty}
Script 2.2.6 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, …
> Get-AzAksCluster
Get-AzAksCluster: The 'Get-AzAksCluster' command was found in the module 'Az.Aks', but the module could not be loaded due to the following error: [Assembly with same name is already loaded]
For more information, run 'Import-Module Az.Aks'.
```
```
### Environment data
```PowerShell
Name Value
---- -----
PSVersion 7.2.10
PSEdition Core
GitCommitId 7.2.10
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
### Module versions
```PowerShell
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 5.3.2 Az.Aks Core,Desk {Get-AzAksCluster, New-AzAksCluster, Remove-AzAksCluster, Import-A…
```
### Error output
```PowerShell
Assembly with same name is already loaded
```
Contributor guide
Assessment
This issue has not been assessed yet.