public override void BeforeRemove( ITargetFramework targetFramework, IDependency dependency, IRemoveDependencyContext context) { if (dependency.TopLevel && dependency.Resolved && dependency.Flags.Contains(DependencyTreeFlags.NuGetPackageDependency)) { // This is a package dependency. // // Try to find an SDK dependency with the same name. string sdkId = Dependency.GetID(targetFramework, SdkRuleHandler.ProviderTypeString, modelId: dependency.Name); if (context.TryGetDependency(sdkId, out IDependency sdk)) { // We are removing the package dependency related to this SDK dependency // and must undo the changes made above in BeforeAdd. // // Set to unresolved, and clear dependencies. context.AddOrUpdate(sdk.ToUnresolved( schemaName: SdkReference.SchemaName, dependencyIDs: ImmutableArray <string> .Empty)); } } context.Accept(); }
public virtual void BeforeRemove( ITargetFramework targetFramework, IDependency dependency, IRemoveDependencyContext context) { context.Accept(); }