Closed kborowinski closed 1 month ago
This really isn't a bug as much as by design for PowerShell. If two modules both add a type extension, it is up to the user to decide which module they want to use. In this situation, you can't import both modules in the same session. If you get the error, you must run Remove-Module
on what is already loaded and then import the other module. Both modules are importing a types.ps1xml
file, and there's no place in the module to force an overwrite, which would have unintended consequences even if you could. There's also no mechanism to import the module without the conflicting type extension. That, too, might have unintended consequences.
The bottom line is that this is not a problem a module author can fix, which is probably why you saw no action on the other module.
If you truly need to run both modules in the same session, I suggest forking the modules and creating customized versions that eliminate the conflicts.
Closing since this is not something I can control.
Describe the problem
PSScriptTools
fails to import with exceptionError in TypeData "System.IO.FileInfo": The member Size is already present.
when imported afterNTSSSecuirty
module:This is also true when the import order is reversed, with the exception that then
NTFSSecuirty
module fails to importReason
Both modules define custom alias property
Size
for theSystem.IO.FileInfo
typeExpectation
PSScriptTools
should import successfully regardless of the import order.Additional Information
There is similar issue opened in the NTFSSecurity repo, however since nothing was done about it for more than a year, I was hoping that @jdhitsolutions will try to fix it on his end (if possible).
PowerShell version
7.4
Platform
Windows 11 Pro or Enterprise
Additional Checks