简体   繁体   English

发布.NET Core应用程序时定位多个运行时

[英]Targeting Multiple Runtimes When Publishing a .NET Core App

I want to create a self contained web application using .NET Core. 我想使用.NET Core创建一个自包含的 Web应用程序。 I want to target any version of Windows and have this in my project.json : 我想定位到任何版本的Windows,并将其放在我的project.json

"runtimes": {
  "win10-x64": { },
  "win8-x64": { },
  "win7-x64": { }
}

When I run dotnet publish --runtime win10-x64 I can only specify a single runtime to publish at a time. 当我运行dotnet publish --runtime win10-x64我只能指定一次要发布的单个运行时。 I then have to maintain three copies of my binaries. 然后,我必须维护我的二进制文件的三个副本。

Is it possible to publish my app for all three runtimes and copy that folder around as a completely self contained application? 是否可以为所有三个运行时发布我的应用程序,并将该文件夹复制为一个完全自包含的应用程序?

When you create a self-contained application, it contains all dependencies it needs to run. 创建自包含应用程序时,它包含运行所需的所有依赖项。 As far as I can tell, the only different between publishing to the various versions of Windows is that for older versions, some dependencies that are built-in in the newer versions have to be bundled in. 据我所知,发布到Windows的各个版本之间的唯一区别是,对于较旧的版本,必须捆绑一些较新版本中内置的依赖项。

This means that if you want to have one version of your self-contained application that runs on all supported versions of Windows, you can: just use the oldest version of Windows ( win7-x64 ). 这意味着,如果您希望拥有一个可以在所有受支持的Windows版本上运行的自包含应用程序的版本,则可以:仅使用Windows的最旧版本( win7-x64 )。

The same approach probably won't work on Linux, since Linux generally does not maintain binary compatibility between versions. 由于Linux通常不维护版本之间的二进制兼容性,因此相同的方法可能不适用于Linux。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 发布.NET Core 2控制台应用程序时出现SQLite错误 - SQLite error when publishing .NET Core 2 Console App .NET Core 2应用程序构建但发布失败 - .NET Core 2 app builds but publishing fails 警告 NETSDK1080:面向 .NET Core 3.0 或更高版本时,不需要对 Microsoft.AspNetCore.App 的 PackageReference - warning NETSDK1080: A PackageReference to Microsoft.AspNetCore.App is not necessary when targeting .NET Core 3.0 or higher 何时在面向.NET 4.0的应用程序中使用IEqualityComparer - When to use IEqualityComparer in an app targeting .NET 4.0 针对.NET Core 2.0 - Targeting .NET Core 2.0 无法在WinDGB中打开Azure App Service .NET Core 2转储文件(转储文件中存在2个运行时) - Cannot open Azure App Service .NET Core 2 dump file in WinDGB (2 runtimes present in dump file) 面向完整框架的ASP.NET Core应用-InProcess IIS? - ASP.NET Core app targeting full framework — InProcess IIS? 面向完整框架的.NET Core应用-停止在IIS中工作 - .NET Core app targeting full framework - Stopped working in IIS 发布Angular 5 + .NET Core Web API时为空白页 - Blank page when publishing Angular 5 + .NET Core Web API 发布 dotnet 应用程序时如何选择特定的 dotnet core sdk - how to choose a particular dotnet core sdk when publishing dotnet app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM