使用dotnet框架的asp.net核心“框架依赖部署”

时间:2016-10-03 11:31:15

标签: asp.net-core asp.net-core-1.0

正如我注意到here,我们有两种类型的部署:“依赖于框架的部署”和“自包含部署”。

但它没有描述如何在net451上获得“依赖于框架的部署”。

我如何在net451上获得“依赖于框架的部署”?

这是我的project.json:

{
  "webroot": "wwwroot",
  "userSecretsId": "aspnet-AdsProject-110defb3-febe-4379-a8a3-0a8b20607a27",
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Routing": "1.0.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": {
      "version": "1.0.1",
      "type": "build"
    },
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.1",
    "Microsoft.Extensions.Caching.Abstractions": "1.0.0",
    "Microsoft.Extensions.Caching.Memory": "1.0.0",
    "Microsoft.Extensions.Configuration.Abstractions": "1.0.0",
    "StackExchange.Redis": "1.1.605",
    "Dapper": "1.50.2",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Routing.Abstractions": "1.0.1",
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
    "Abot": "1.5.1.50"
  },

  "tools": {
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "imports": [
        "portable-net45+win8"
      ]
    }
  },

  "frameworks": {
    "net451": {
      "frameworkAssemblies": {
        "System.Runtime.Serialization": "4.0.0.0",
        "System.ServiceModel": "4.0.0.0"
      }
    }
  },

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

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "config.json",
      "config.Development.json",
      "web.config"
    ],
    "exclude": [
      "node_modules",
      "bower_components",
      "SqlScripts",
      "PrivateJs",
      "**.xproj",
      "**.user",
      "**.vspscc"
    ]
  },

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

1 个答案:

答案 0 :(得分:1)

简短的回答:你已经拥有它了。

定位net451,您将目标框架设置为.NET Framework 4.5.1,并且必须在安装应用程序之前使用.NET Framework可再发行组件(Dotnetfx.exe)将其安装在目标计算机上。换句话说,.NET Framework应用程序总是依赖于框架。

另一方面,自包含部署(SCD)仅与.NET Core Framework相关,并允许与app一起部署框架:

  

对于自包含部署,您不仅要部署应用程序和任何第三方依赖项,还要部署使用它构建应用程序的.NET Core版本。