在ApplicationParts.Remove()之后删除文件

时间:2019-04-26 09:14:02

标签: c# .net-core

将.dll文件添加到程序集(ApplicationParts.Add),并将其删除(ApplicationParts.RemoveAt)后,是否可以删除它?

var assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(pathToWrite + fileModel.Name + ".dll");
if (assembly != null)
{
    _partManager.ApplicationParts.Add(new AssemblyPart(assembly));
    CustomActionDescriptorChangeProvider.Instance.HasChanged = true;
    CustomActionDescriptorChangeProvider.Instance.TokenSource.Cancel();
}
_partManager.ApplicationParts.RemoveAt(3);
File.Delete(pathToWrite + fileModel.Name + ".dll");// error

0 个答案:

没有答案
相关问题