You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rain Sallow (/u/ta11ow) (@vexx32) In Windows PowerShell, Add-Type has (or had?) a list of partial name to full name mappings so that you could load assemblies by partial name without going through the deprecated-since-forever LoadWithPartialName() API. All of this stuff is related to the GAC but on Core, there is no GAC and no partial names.
Rain Sallow (/u/ta11ow) (@vexx32) In Windows PowerShell, Add-Type has (or had?) a list of partial name to full name mappings so that you could load assemblies by partial name without going through the deprecated-since-forever LoadWithPartialName() API. All of this stuff is related to the GAC but on Core, there is no GAC and no partial names.
Now it just does Assembly.Load(new AssemblyName(assemblyName)), which will still load from the GAC on Windows, even on Core. I believe non-Windows will still try to load from AppDomain.CurrentDomain.BaseDirectory (which would be where ever pwsh is installed), so System.Web should still work there too.
Reacted by Rain Sallow (/u/ta11ow) and Michael Klement
I think using assembly should have parity with Add-Type -AssemblyName, especially since Windows PowerShell had it.
Ilya (@iSazonov) Can you remove Resolution-Answered so this isn't closed? I think even if the PowerShell team disagrees, this would need Resolution-Won't Fix instead.
Reacted by Rain Sallow (/u/ta11ow), Mathias R. Jessen and Michael Klement
Patrick Meinecke (@SeeminglyScience) I am not in MSFT, I am a community maintainer. Sometimes I do a formal moderation based on trusting. "Formal" because I really can not looks every (from 2000!) issue in depth.
As for "Won't fix" I'd leave this to MSFT experts and PowerShell Committee to mark issues with backward compatibility and security considerations.
Reacted by Rain Sallow (/u/ta11ow) and Patrick Meinecke
I am not in MSFT, I am a community maintainer. Sometimes I do a formal moderation based on trusting. "Formal" because I really can not looks every (from 2000!) issue in depth.
As for "Won't fix" I'd leave this to MSFT experts and PowerShell Committee to mark issues with backward compatibility and security considerations.
Oh yeah I know, and you do an awesome job! I'm very glad the repo has you sorting through the chaos 🙂
I only meant to explain the reasoning behind my request, I 100% understand why you chose the original label.
Indeed, name-only loading of assemblies that PowerShell ships with should work (plus from the GAC, on Windows) - both for symmetry Add-Type -AssemblyName and because using assembly System.Windows.Forms, for instance, works just fine in Windows PowerShell.
Activity
bpayette commentedon Jun 18, 2019
jszabo98 PowerShell Core doesn't support
using assembly ...with partial names. If you use the full path to the assembly, it should work.vexx32 commentedon Jun 18, 2019
Seems weird that it doesn't support assembly names. The first thing I think to parallel
using assemblyisAdd-Type -AssemblyName😕BrucePay commentedon Jun 19, 2019
Rain Sallow (/u/ta11ow) (@vexx32) In Windows PowerShell,
Add-Typehas (or had?) a list of partial name to full name mappings so that you could load assemblies by partial name without going through the deprecated-since-foreverLoadWithPartialName()API. All of this stuff is related to the GAC but on Core, there is no GAC and no partial names.SeeminglyScience commentedon Jun 19, 2019
Now it just does
Assembly.Load(new AssemblyName(assemblyName)), which will still load from the GAC on Windows, even on Core. I believe non-Windows will still try to load fromAppDomain.CurrentDomain.BaseDirectory(which would be where ever pwsh is installed), soSystem.Webshould still work there too.SeeminglyScience commentedon Jun 19, 2019
I think
using assemblyshould have parity withAdd-Type -AssemblyName, especially since Windows PowerShell had it.Ilya (@iSazonov) Can you remove
Resolution-Answeredso this isn't closed? I think even if the PowerShell team disagrees, this would needResolution-Won't Fixinstead.iSazonov commentedon Jun 20, 2019
I checked that follow works
so follow should works too
Patrick Meinecke (@SeeminglyScience) I am not in MSFT, I am a community maintainer. Sometimes I do a formal moderation based on trusting. "Formal" because I really can not looks every (from 2000!) issue in depth.
As for "Won't fix" I'd leave this to MSFT experts and PowerShell Committee to mark issues with backward compatibility and security considerations.
SeeminglyScience commentedon Jun 20, 2019
Oh yeah I know, and you do an awesome job! I'm very glad the repo has you sorting through the chaos 🙂
I only meant to explain the reasoning behind my request, I 100% understand why you chose the original label.
mklement0 commentedon Dec 26, 2023
I just realized I accidentally created a duplicate:
using assemblystatement cannot be used to load well-known assemblies #11856Indeed, name-only loading of assemblies that PowerShell ships with should work (plus from the GAC, on Windows) - both for symmetry
Add-Type -AssemblyNameand becauseusing assembly System.Windows.Forms, for instance, works just fine in Windows PowerShell.