From 3da6b89dab8eea8190c1e8e4ffc27b3acda7216c Mon Sep 17 00:00:00 2001 From: Steve Harter Date: Tue, 20 Feb 2018 15:19:52 -0600 Subject: [PATCH] Update assembly-conflict-resolution.md Commit migrated from https://github.com/dotnet/core-setup/commit/25ca966c9cb71ee8bf45816d36f76ec37ba76e9c --- docs/installer/design-docs/assembly-conflict-resolution.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/installer/design-docs/assembly-conflict-resolution.md b/docs/installer/design-docs/assembly-conflict-resolution.md index 0707d03..70560ab 100644 --- a/docs/installer/design-docs/assembly-conflict-resolution.md +++ b/docs/installer/design-docs/assembly-conflict-resolution.md @@ -28,7 +28,7 @@ For example, here's the probing order on Windows when running a non-published fo * `C:\\Program files\\dotnet\\shared\\Microsoft.NETCore.App\\2.0.0` * (app location) * `C:\\Users\\\\.nuget\\packages` -* `C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackagesFallback` + `C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackagesFallback` * `C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder` Once a deps.json entry has been found in a probe location, no further probes are performed for that entry. @@ -46,7 +46,7 @@ The order in which each layer's deps.json is processed is: 1. -->If the probing path is a framework, then check its deps.json to see if it contains the exact package (by name and version). If so, then use the framework's location and end probing for this entry 1. -->If the probing path is not a framework, then use that location and end probing for this entry 1. Read the additional deps from `--additional-deps` and repeat steps 3-5 -1. Read each framework's deps.json and repeat steps 3-5 +1. Read each framework's deps.json (higher to lower) and repeat steps 3-5 1. Pass the set of assemblies and their paths to the CLR Note that for an app, its probing path comes *after* the framework's, so intuitively it would appear that "framework wins" in collisions. However, because the app's deps.json is parsed *before* the framework's deps.json and because the app will likely reference an OOB package that the framework doesn't (because a framework, at least Microsoft.NETCore.App, has its own metapackage and does not reference OOB packages), the framework probing path never matches up in step 4 for the app's deps.json package\assembly entry, so it goes to the next probing path which is the app's and because the package matches the "app wins". @@ -54,8 +54,12 @@ Note that for an app, its probing path comes *after* the framework's, so intuiti ## Proposed changes for 2.1 Probe the app location before the framework's. This means flip (3) and (4) under **Probe Ordering** above and treat the app as the highest-level framework. The reason is that there may be frameworks that use OOB packages like apps, and we want to have "app wins" in non roll-forward cases. +Replace step 3 under **Algorithm** above with: +* For each probing path except frameworks that are higher-level + +The reason for this change is that a given framework should never have a dependency on a higher-level framework, and is expected to find deps assets in its layer or lower. This is also required so that the given framework can find its asset, and replace the higher-level asset (see next paragraph). + Replace step 4 under **Algorithm** above with: -* If the probing path is a framework, and no [minor] or [major] roll-forward occurred for this framework, then check its deps.json to see if it contains the exact package (by name and version). If so, then use the framework's location and end probing for this entry -* If the probing path is a framework, and a [minor] or [major] roll-forward occurred for this framework, then check its deps.json to see if it contains a newer version of the assembly (by Assembly Version and then File Version if necessary). If so, then use the framework's location and end probing for this entry +* If the probing path is a framework, then check its deps.json to see if it contains the exact package (by name and version). If so check if a [minor] or [major] roll-forward occurred for this framework. If true (roll-forward), then check its deps.json to see if it contains a newer version of the assembly (by Assembly Version and then File Version if necessary) compared to a previously found deps entry and use that and end probing for this entry. If false (no roll-forward), then use that location and end probing for this entry. In order to compare Assembly Version and File Version, additional metadata will need to be written to each deps.json file. If this metadata is not present (as in the case of applications published prior to 2.1) then the assembly will be considered older and will not replace any locations that the assembly was previously found at. -- 2.7.4