【问题标题】:Microsoft.Composition 1.0.27 incompatible with .NETCoreApp,Version=v1.0Microsoft.Composition 1.0.27 与 .NETCoreApp 不兼容,版本=v1.0
【发布时间】:2017-03-14 05:14:21
【问题描述】:

在为新项目的发布进行编译时出现此错误。使用 .Net 4.52 作为一些旧包的主要框架(主要是 Paypal)

我使用框架中的“导入”部分阅读了很多其他帖子,但这对我解决这个问题没有帮助。

错误信息:

包 Microsoft.Composition 1.0.27 不兼容 netcoreapp1.0(.NETCoreApp,版本=v1.0)。

包 Microsoft.Composition 1.0.27 支持: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%" ]
  }

【问题讨论】:

标签: c# asp.net-mvc .net-core


【解决方案1】:

使用以下内容编辑 project.JSON 解决了​​我的问题:

  "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%" ]
  }

【讨论】:

    【解决方案2】:

    该消息准确地描述了问题。您的项目以 .Net Core 1.0 为目标,并且包与它不兼容。

    发生这种情况是因为并非所有 .Net 平台和版本都兼容。例如 .Net Core 1.0 仅与 .Net Standard 1.6 兼容。这个page 显示了一个表格,其中包含不同 .Net 平台之间的兼容性。

    在这种特定情况下,您的目标是 .Net Core 1.0,而包的目标是 4.5。如您在表中所见,这些不兼容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-24
      • 2017-11-21
      相关资源
      最近更新 更多