1
當我注意到here時,我們有兩種類型的部署:「依賴於框架的部署」和「獨立部署」。使用dotnet框架的asp.net核心「基於框架的部署」
但它沒有描述如何在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%" ]
}
}
當我發佈該項目時,dotnet也會生成一個.exe文件。正如文章所述,.exe文件以SCD模式生成。 「 」SCD包含一個可執行文件(例如Windows應用程序的Windows平臺上的app.exe)「和」FDD包含可以通過命令行使用dotnet實用程序啓動的.dll文件「 –
我不想。 exe文件。每次我想發佈項目時,我都必須停止生產應用程序。 –
.exe是由於您的目標框架是.NET Framework而生成的,它對.NET Core Platform一無所知,因此您擁有「舊類型」獨立應用程序(建議閱讀此文章https://blogs.msdn.microsoft.com/ cesardelatorre/2016/06/28/running-net-core-apps-on-multiple-frameworks-and-what-the-target-framework-monikers-tfms-are-about /)。關於「在發佈過程中停止」 - 如果您更改程序集,您無論如何都需要重新啓動進程......也許您的意思是使用dotnet-watch,但它也會在檢測到源代碼更改時重新啓動指定的應用程序。 – Set