Could not load file or assembly

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
dank42
Posts: 61
Last visit: Tue Apr 26, 2022 7:49 am

Could not load file or assembly

Post by dank42 »

I keep getting this when I run my script/form?

Checked in the options under assemblies but I can't the one it is referring to?

ERROR: Exception calling "Load" with "1" argument(s): "Could not load file or assembly 'AspNetMMCExt, Version=4.0.0.0, Culture=neutral,
ERROR: PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."
Exchange-Tools.psf: ERROR: At Line: -120 char: 2
ERROR: + [void][reflection.assembly]::Load('AspNetMMCExt, Version=2.0.0.0, ...
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
ERROR: + FullyQualifiedErrorId : FileNotFoundException
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Could not load file or assembly

Post by jvierra »

The assembly is not specified correctly or it is not installed.
Try this as it can get the assembly if it is in the GAC.

[reflection.assembly]::LoadWithPartialName('AspNetMMC')
[reflection.assembly]::LoadWithPartialName('AspNetMMCExt')
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Could not load file or assembly

Post by jvierra »

THe documentation notes the following:
This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Provides helper methods that are used by the ASP.NET snap-in for the Microsoft Management Console (MMC). This class cannot be inherited.
See: https://msdn.microsoft.com/en-us/librar ... .110).aspx
This topic is 5 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked