fix upgrade issue which can occur in development environments
This commit is contained in:
parent
5a77c83e68
commit
f7cf25c4bb
|
@ -1,5 +1,6 @@
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
|
@ -507,18 +508,22 @@ namespace Oqtane.Infrastructure
|
||||||
|
|
||||||
private void RemoveAssemblies(string[] assemblies, string version)
|
private void RemoveAssemblies(string[] assemblies, string version)
|
||||||
{
|
{
|
||||||
foreach (var assembly in assemblies)
|
// in a development environment assemblies cannot be removed as the debugger runs fron /bin folder and locks the files
|
||||||
|
if (!_environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
try
|
foreach (var assembly in assemblies)
|
||||||
{
|
{
|
||||||
var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
try
|
||||||
var filepath = Path.Combine(binFolder, assembly);
|
{
|
||||||
if (System.IO.File.Exists(filepath)) System.IO.File.Delete(filepath);
|
var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||||
}
|
var filepath = Path.Combine(binFolder, assembly);
|
||||||
catch (Exception ex)
|
if (System.IO.File.Exists(filepath)) System.IO.File.Delete(filepath);
|
||||||
{
|
}
|
||||||
// error deleting asesmbly
|
catch (Exception ex)
|
||||||
_filelogger.LogError(Utilities.LogMessage(this, $"Oqtane Error: {version} Upgrade Error Removing {assembly} - {ex}"));
|
{
|
||||||
|
// error deleting asesmbly
|
||||||
|
_filelogger.LogError(Utilities.LogMessage(this, $"Oqtane Error: {version} Upgrade Error Removing {assembly} - {ex}"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user