Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

React to the deprecation of Microsoft.AspNetCore.All #8751

Merged
merged 1 commit into from
Nov 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ internal class ApplicationAssembliesProvider
{
internal static HashSet<string> ReferenceAssemblies { get; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
// The deps file for the Microsoft.AspNetCore.All shared runtime is authored in a way where it does not say
// The deps file for the Microsoft.AspNetCore.App shared runtime is authored in a way where it does not say
// it depends on Microsoft.AspNetCore.Mvc even though it does. Explicitly list it so that referencing this runtime causes
// assembly discovery to work correctly.
"Microsoft.AspNetCore.All",
"Microsoft.AspNetCore.App",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think app did not have the same problem as All, but this is fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context: here is what the deps.json file looks like now: https://gist.githubusercontent.com/natemcmaster/928c1973a136e7c3690f0ac628873a1d/raw/50a0a387e45a3878e114ef90bc90ab82a57dbee7/webapp1.deps.json.

If I understand right, this section of code is looking for dependencies. Microsoft.AspNetCore.Mvc won't appear as in "dependencies" or "libraries" anymore.

    ".NETCoreApp,Version=v3.0": {
      "webapp1/1.0.0": {
        "dependencies": {
          "Microsoft.AspNetCore.App": "3.0.0-preview-001",
          "Microsoft.NETCore.App": "3.0.0-preview-27113-06"
        },
        "runtime": {
          "webapp1.dll": {}
        },
        "compile": {
          "webapp1.dll": {}
        }
      },
      "Microsoft.AspNetCore.App/3.0.0-preview-001": {
        "compile": {
          // ... list of ref assemblies here
          "ref/netcoreapp3.0/Microsoft.AspNetCore.Mvc.dll": {},
        }
      },

"Microsoft.AspNetCore.Mvc",
"Microsoft.AspNetCore.Mvc.Abstractions",
"Microsoft.AspNetCore.Mvc.ApiExplorer",
Expand Down Expand Up @@ -154,7 +154,7 @@ private AssemblyItem GetAssemblyItem(Assembly assembly)
// Internal for unit testing
internal static IEnumerable<RuntimeLibrary> GetCandidateLibraries(DependencyContext dependencyContext)
{
// When using Microsoft.AspNetCore.App \ Microsoft.AspNetCore.All shared runtimes, entries in the RuntimeLibraries
// When using the Microsoft.AspNetCore.App shared runtimes, entries in the RuntimeLibraries
// get "erased" and it is no longer accurate to query to determine a library's dependency closure.
// We'll use CompileLibraries to calculate the dependency graph and runtime library to resolve assemblies to inspect.
var candidatesResolver = new CandidateResolver(dependencyContext.CompileLibraries, ReferenceAssemblies);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public void ResolveAssemblies_ReturnsCurrentAssembly_IfDepsFileDoesNotHaveAnyCom
// Arrange
var runtimeLibraries = new[]
{
GetRuntimeLibrary("MyApp", "Microsoft.AspNetCore.All"),
GetRuntimeLibrary("Microsoft.AspNetCore.All", "Microsoft.NETCore.App"),
GetRuntimeLibrary("MyApp", "Microsoft.AspNetCore.App"),
GetRuntimeLibrary("Microsoft.AspNetCore.App", "Microsoft.NETCore.App"),
GetRuntimeLibrary("Microsoft.NETCore.App"),
GetRuntimeLibrary("ClassLibrary"),
};
Expand Down Expand Up @@ -257,22 +257,22 @@ public void GetCandidateLibraries_IgnoresMvcAssemblies()
public void GetCandidateLibraries_ReturnsRuntimeLibraries_IfCompileLibraryDependencyToMvcIsPresent()
{
// Arrange
// When an app is running against Microsoft.AspNetCore.All shared runtime or if the DependencyContext is queried
// When an app is running against Microsoft.AspNetCore.App shared runtime or if the DependencyContext is queried
// from an app that's running on Microsoft.NETCore.App (e.g. in a unit testing scenario), the
// runtime library does not state that the app references Mvc whereas the compile library does. This test validates
// that we correctly recognize this scenario.
var expected = GetRuntimeLibrary("MyApp", "Microsoft.AspNetCore.All");
var expected = GetRuntimeLibrary("MyApp", "Microsoft.AspNetCore.App");
var runtimeLibraries = new[]
{
expected,
GetRuntimeLibrary("Microsoft.AspNetCore.All", "Microsoft.NETCore.App"),
GetRuntimeLibrary("Microsoft.AspNetCore.App", "Microsoft.NETCore.App"),
GetRuntimeLibrary("Microsoft.NETCore.App"),
};

var compileLibraries = new[]
{
GetCompileLibrary("MyApp", "Microsoft.AspNetCore.All"),
GetCompileLibrary("Microsoft.AspNetCore.All", "Microsoft.AspNetCore.Mvc", "Microsoft.NETCore.App"),
GetCompileLibrary("MyApp", "Microsoft.AspNetCore.App"),
GetCompileLibrary("Microsoft.AspNetCore.App", "Microsoft.AspNetCore.Mvc", "Microsoft.NETCore.App"),
GetCompileLibrary("Microsoft.AspNetCore.Mvc"),
GetCompileLibrary("Microsoft.NETCore.App"),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void ReferenceAssemblies_ReturnsLoadableReferenceAssemblies()
var additionalAssemblies = new[]
{
// The following assemblies are not reachable from Microsoft.AspNetCore.Mvc
"Microsoft.AspNetCore.All",
"Microsoft.AspNetCore.App",
"Microsoft.AspNetCore.Mvc.Formatters.Xml",
};

Expand Down