0
votes

I have a middle ware in asp.net core which work fine but now it give below error

The type 'Task' exists in both 'System.Threading.Tasks, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ERP..NETCoreApp,Version=v1.1

I tried alias and absolute reference as well but it did not worked.

enter image description here

Here is the Project.json

{
  "dependencies": {
    "AutoMapper": "5.2.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.Session": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.2.0-preview1-23015",
    "Microsoft.NETCore.App": {
      "version": "1.1",
      "type": "platform"
    }
  },

  "tools": {
  },

  "frameworks": {
    "netcoreapp1.1": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "Areas/**/*.cshtml",
      "wwwroot",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  },
  "userSecretsId": "aspnet-ERP-20161109085850"
}
1
please copy your method code. I cannot see it because of the information popupNicoRiff
Post your project.json, you have messed up your references somewhere. I suspect you have either added the full .NET Framework assembly in the frameworks section to a .NET Core Application / .NET Standard library or one of your dependencies doesTseng
@Tseng project.json added in question.Ahmar

1 Answers

0
votes

I am able to solve this change the Debug package version.

"Microsoft.Extensions.Logging.Debug": "1.2.0-preview1-23015",

To

"Microsoft.Extensions.Logging.Debug": "1.1.0",

And also make change in Invoke method signature

public Task Invoke(HttpContext httpContext)

To

public async Task Invoke(HttpContext httpContext)