Skip to content

Errors after upgrading from RC2 to RTM #5884

Closed as not planned
Closed as not planned
@sam-wheat

Description

@sam-wheat

Steps to reproduce

I am reporting two issues that appear to be related. Project fails on build or startup so the step to reproduce is to attempt to build or run.

The issue

ERROR 1:
Error CS0121 The call is ambiguous between the following methods or properties: 'Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.UseContentRoot(Microsoft.AspNetCore.Hosting.IWebHostBuilder, string)' and 'Microsoft.AspNetCore.Hosting.HostingAbstractionsWebHostBuilderExtensions.UseContentRoot(Microsoft.AspNetCore.Hosting.IWebHostBuilder, string)'

The error occurs in Program.cs of my web project:
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory()) //error here
.UseIISIntegration()
.UseStartup()
.Build();
host.Run();
}
}

ERROR 2:

If I comment out the following line in Startup.cs in the Blog project my project will build:
.UseContentRoot(Directory.GetCurrentDirectory()) //error here
However, it will not load and it fails with the same error message as found in this post:
#5881
The error message is:
Could not load type 'Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions' from assembly 'Microsoft.Extensions.DependencyInjection, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

Further technical details

I followed the instructions found here: https://docs.efproject.net/en/latest/miscellaneous/rc2-rtm-upgrade.html
After changing the EF package versions my projects would not build. The error message was that the logging and memory cache packages needed to be upgraded so I changed these packages as follows:
"Microsoft.Extensions.Logging": "1.0.0" (Blog, Blog.API)
"Microsoft.Extensions.Caching.Memory": "1.0.0", (Blog.API)
"Microsoft.Extensions.Caching.Abstractions": "1.0.0" (Blog.API)

EF Core version: (found in project.json or packages.config)
Operating system: Windows 10
Visual Studio version: 2015 Update 3

Other details about my project setup:

There are several projects in my solution. The three that are mentioned in this post are Blog, Blog.API, and Blog.Services (class library DBContext here).

Blog Project.json

    {
      "userSecretsId": "aspnet-RC2CoreTest2-d092f974-1ed6-4625-b2e4-825fd01d61d9",
      "version": "1.0.0-*",
      "dependencies": {
        "NETStandard.Library": "1.5.0-rc2-24027",
        "Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final",
        "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0-rc2-final",
        "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
        "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0-rc2-final",
        "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0-rc2-final",
        "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
        "Microsoft.AspNetCore.Razor.Tools": {
          "version": "1.0.0-preview1-final",
          "type": "build"
        },
        "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
        "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
        "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
        "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
        "Microsoft.EntityFrameworkCore.Tools": {
          "version": "1.0.0-preview2-final",
          "type": "build"
        },
        "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
        "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
        "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-final",
        "Microsoft.Extensions.Logging": "1.0.0",
        "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
        "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
        "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final",
        "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
          "version": "1.0.0-preview1-final",
          "type": "build"
        },
        "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
          "version": "1.0.0-preview1-final",
          "type": "build"
        }
      },
      "tools": {
        "Microsoft.AspNetCore.Razor.Tools": {
          "version": "1.0.0-preview1-final",
          "imports": "portable-net45+win8+dnxcore50"
        },
        "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
          "version": "1.0.0-preview1-final",
          "imports": "portable-net45+win8+dnxcore50"
        },
        "Microsoft.EntityFrameworkCore.Tools": {
          "version": "1.0.0-preview2-final",
          "imports": [
            "portable-net45+win8+dnxcore50",
            "portable-net45+win8"
          ]
        },
        "Microsoft.Extensions.SecretManager.Tools": {
          "version": "1.0.0-preview1-final",
          "imports": "portable-net45+win8+dnxcore50"
        },
        "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
          "version": "1.0.0-preview1-final",
          "imports": [
            "portable-net45+win8+dnxcore50",
            "portable-net45+win8"
          ]
        }
      },
      "frameworks": {
        "net462": {
          "frameworkAssemblies": {
            "System.Drawing": "4.0.0.0"
          }
        }
      },
      "buildOptions": {
        "emitEntryPoint": true,
        "preserveCompilationContext": true
      },
      "runtimeOptions": {
        "gcServer": true
      },
      "publishOptions": {
        "include": [
          "wwwroot",
          "Views",
          "appsettings.json",
          "web.config"
        ]
      },
      "scripts": {
        "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
        "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
      }
    }

Blog.API Project.json

{
  "version": "1.0.0-*",
  "dependencies": {
    "NETStandard.Library": "1.5.0-rc2-24027",
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
    "Autofac": "4.0.0-rc2-240",
    "Autofac.Extensions.DependencyInjection": "4.0.0-rc2-240",
    //"System.AppDomain": "2.0.5",
    "Blog.Core": "1.0.0-*",
    "Blog.Domain": "1.0.0-*",
    "Blog.Model": "1.0.0-*",
    "Blog.Services": "1.0.0-*",
    "Microsoft.AspNetCore.Session": "1.0.0-rc2-final",
    "Microsoft.Extensions.Caching.Memory": "1.0.0",
    "Microsoft.Extensions.Caching.Abstractions": "1.0.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    }
  },

  "frameworks": {
    "net462": {
      "frameworkAssemblies": {
        "System.Drawing": "4.0.0.0"
      }
    }
  },
  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },
  "runtimeOptions": {
    "gcServer": true
  },
  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

Blog.Services Project.json

{
  "version": "1.0.0-*",

  "dependencies": {
    "Blog.Core": "1.0.0-*",
    "Blog.Domain": "1.0.0-*",
    "Blog.Model": "1.0.0-*",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
    "NETStandard.Library": "1.5.0-rc2-24027"
  },
  //"buildOptions": {
  //  "emitEntryPoint": true
  //},

  "frameworks": {
    "net462": {}
  },

  "tools": {
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview2-final",
      "imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions