improvements to module/theme installation and removal

This commit is contained in:
Shaun Walker
2019-10-09 12:06:53 -04:00
parent 879dae75aa
commit 2607d4dbb3
23 changed files with 169 additions and 37 deletions

View File

@ -187,8 +187,8 @@ namespace Oqtane.Server
Assembly assembly = assemblies.Where(item => item.Location == file.FullName).FirstOrDefault();
if (assembly == null)
{
// load assembly ( as long as dependencies are in /bin they will load as well )
assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(file.FullName);
// load assembly from stream to prevent locking file ( as long as dependencies are in /bin they will load as well )
assembly = AssemblyLoadContext.Default.LoadFromStream(new MemoryStream(File.ReadAllBytes(file.FullName)));
moduleassemblies.Add(assembly);
}
}
@ -200,8 +200,8 @@ namespace Oqtane.Server
Assembly assembly = assemblies.Where(item => item.Location == file.FullName).FirstOrDefault();
if (assembly == null)
{
// load assembly ( as long as dependencies are in /bin they will load as well )
assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(file.FullName);
// load assembly from stream to prevent locking file ( as long as dependencies are in /bin they will load as well )
assembly = AssemblyLoadContext.Default.LoadFromStream(new MemoryStream(File.ReadAllBytes(file.FullName)));
}
}
@ -374,9 +374,8 @@ namespace Oqtane.Server
Assembly assembly = assemblies.Where(item => item.Location == file.FullName).FirstOrDefault();
if (assembly == null)
{
// load assembly ( as long as dependencies are in /bin they will load as well )
assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(file.FullName);
moduleassemblies.Add(assembly);
// load assembly from stream to prevent locking file ( as long as dependencies are in /bin they will load as well )
assembly = AssemblyLoadContext.Default.LoadFromStream(new MemoryStream(File.ReadAllBytes(file.FullName)));
}
}
@ -387,8 +386,8 @@ namespace Oqtane.Server
Assembly assembly = assemblies.Where(item => item.Location == file.FullName).FirstOrDefault();
if (assembly == null)
{
// load assembly ( as long as dependencies are in /bin they will load as well )
assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(file.FullName);
// load assembly from stream to prevent locking file ( as long as dependencies are in /bin they will load as well )
assembly = AssemblyLoadContext.Default.LoadFromStream(new MemoryStream(File.ReadAllBytes(file.FullName)));
}
}