Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3207 - issue with colliding assemblies #3288

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/Commands/Base/PnPPowerShellModuleInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ private static Assembly ResolveAssembly_NetCore(
AssemblyLoadContext assemblyLoadContext,
AssemblyName assemblyName)
{
if (assemblyName.Name.Equals("PnP.PowerShell.ALC"))
{
string filePath = GetRequiredAssemblyPath(assemblyName);
if (!string.IsNullOrEmpty(filePath))
{
// - In .NET, load the assembly into the custom assembly load context.
return s_proxy.LoadFromAssemblyPath(filePath);
}
}

if (IsAssemblyMatching(assemblyName))
{
string filePath = GetRequiredAssemblyPath(assemblyName);
Expand Down Expand Up @@ -131,8 +141,7 @@ private static bool IsAssemblyMatching(AssemblyName assemblyName)
private static string GetRequiredAssemblyPath(AssemblyName assemblyName)
{
string fileName = assemblyName.Name + ".dll";
string filePath = Path.Combine(s_binBasePath, fileName);

string filePath = Path.Combine(s_binBasePath, fileName);
if (File.Exists(filePath))
return filePath;

Expand Down
8 changes: 0 additions & 8 deletions src/Commands/_debug/debug.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@
$BinPath = "$ProjectPath\bin\Debug"

$dlls = @("PnP.PowerShell.ALC.dll", "PnP.PowerShell.dll")

$netversion = "net6.0-windows"

if ($PSEdition -eq 'Core') {
$netversion = "net6.0-windows"
}
else {
$netversion = "net462"
}

$BinPath = "$BinPath\$netversion"

foreach ($dll in $dlls) {
Expand Down
Loading