1
votes

Have been getting this error when compiling for publish on a new project. Used .Net 4.52 as main framework for some older packages (Mostly Paypal)

I have read over a lot of other posts using the "Import" section in the frameworks but this has not helped in my case for over coming this issue.

Error Message:

Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0).

Package Microsoft.Composition 1.0.27 supports: portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)

Project.Json:

"dependencies": {
    "BundlerMinifier.Core": "2.2.306",
    "MailKit": "1.10.2",
    "Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.Http.Features": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
    "PayPal": "1.8.0",
    "Microsoft.AspNetCore.Http": "1.1.0",
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.1.0-preview4-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.1.0-preview4-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Session": "1.0.0"
    },
  "tools": {
    "BundlerMinifier.Core": "2.2.281",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.1.0-msbuild3-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.1.0-preview4-final"
  },

  "frameworks": {
      "net452": {
        "imports": [ "dnxcore50", "portable-net45+win8" ]
      }
    },

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

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

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
2

2 Answers

0
votes

Editing project.JSON with the following fixed my issue:

  "dependencies": {
    "BundlerMinifier.Core": {
      "version": "2.2.281",
      "type": "build",
      "imports": [ "portable-net45+win8+wp8+wpa81" ]
    },
    "MailKit": "1.10.2",
    "Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.Http.Features": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
    "Microsoft.AspNetCore.Http": "1.1.0",
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
      "version": "1.1.0-msbuild3-final",
      "type": "build",
      "imports": [ "portable-net45+win8+wp8+wpa81" ]
    },

    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.1.0-preview4-final",
      "type": "build",
      "imports": [ "portable-net45+win8+wp8+wpa81" ]
    },
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build",
      "imports": [ "portable-net45+win8+wp8+wpa81" ]
    },
    "Microsoft.AspNetCore.Session": "1.0.0",
    "PayPal": "1.8.0"
  },

  "tools": {
    "BundlerMinifier.Core": {
      "version": "2.2.281",
      "type": "build",
      "imports": [ "portable-net45+win8+wp8+wpa81" ]
    },
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build",
      "imports": [ "portable-net45+win8+wp8+wpa81" ]
    },
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
      "version": "1.1.0-msbuild3-final",
      "type": "build",
      "imports": [ "portable-net45+win8+wp8+wpa81" ]
    },
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.1.0-preview4-final",
      "type": "build",
      "imports": [ "portable-net45+win8+wp8+wpa81" ]
    },
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.1.0-preview4-final",
      "type": "build",
      "imports": [ "portable-net45+win8+wp8+wpa81" ]
    }
  },

  "frameworks": {
    "net452": {
      "imports": [ "dnxcore50", "portable-net45+win8+wp8+wpa81" ]
    }
  },

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

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

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
-1
votes

The message describes exactly the issue. Your project is targetting .Net Core 1.0 and the package is not compatible with it.

This happens because not all .Net platforms and versions are compatible. For example .Net Core 1.0 is only compatible with .Net Standard 1.6. This page shows a table with the compatibility between the different .Net platforms.

In this specific case you are targetting .Net Core 1.0 and the package is targetting 4.5. These are not compatible as you can see in the table.