public override void ReferenceActivated(ExtensionLoadingContext context, ExtensionReferenceProbeEntry referenceEntry) { if (string.IsNullOrEmpty(referenceEntry.VirtualPath)) return; string sourceFileName = _virtualPathProvider.MapPath(referenceEntry.VirtualPath); // Copy the assembly if it doesn't exist or if it is older than the source file. bool copyAssembly = !_assemblyProbingFolder.AssemblyExists(referenceEntry.Name) || File.GetLastWriteTimeUtc(sourceFileName) > _assemblyProbingFolder.GetAssemblyDateTimeUtc(referenceEntry.Name); if (copyAssembly) { context.CopyActions.Add(() => _assemblyProbingFolder.StoreAssembly(referenceEntry.Name, sourceFileName)); // We need to restart the appDomain if the assembly is loaded if (_hostEnvironment.IsAssemblyLoaded(referenceEntry.Name)) { Logger.Information("ReferenceActivated: Reference \"{0}\" is activated with newer file and its assembly is loaded, forcing AppDomain restart", referenceEntry.Name); context.RestartAppDomain = true; } } }
public void ReferenceDeactivated(ExtensionLoadingContext context, ExtensionReferenceProbeEntry referenceEntry) { throw new NotImplementedException(); }
public virtual void ReferenceActivated(ExtensionLoadingContext context, ExtensionReferenceProbeEntry referenceEntry) { }