Reputation: 15016
I'm trying to debug a DLL loading issue with my application, and part of my process involves verifying the runtime dependencies for my assemblies. I wanted to check the bitness of my DLLs as well, just to make sure nothing is mismatched.
Anyhow, I am trying to use PowerShell to do this, but it's never able to find the DLL that I have specified. As a sanity check, I decided to try a .NET 4 assembly, and it still fails.
Please see the following image -- what am I doing wrong here?
I've seen suggestions elsewhere, like running PowerShell as admin and also using Set-ExecutionPolicy unrestricted
. I've done those, without any success.
Upvotes: 1
Views: 446
Reputation: 437548
Before passing relative paths to .NET methods, execute the following, to ensure that .NET uses the same working directory as PowerShell (which is not the case by default, unfortunately):
[Environment]::CurrentDirectory = $PWD
Alternatively, prefix relative paths with $PWD
to convert them to absolute ones; in your example:
[System.Reflection.Assembly]::GetAssemblyName("$PWD\System.Net.dll")
Upvotes: 1