简体   繁体   English

ASP.NET Core 发布和启动设置

[英]ASP.NET Core publish and launch settings

I have a ASP.NET Core (v2.0) and I'm looking to retain my launchSettings.json properties across different environments.我有一个 ASP.NET Core (v2.0),我希望在不同环境中保留我的launchSettings.json属性。

The issue I'm experiencing is whenever I publish my project with dotnet publish , my artifacts folder containing the published output does not contain a launchSettings.json file.我遇到的问题是,每当我使用dotnet publish发布我的项目时,包含已发布输出的 artifacts 文件夹不包含launchSettings.json文件。 Does this compile into something else?这会编译成别的东西吗?

launchSettings.json is a setting for IDE (Visual Studio, Visual Studio Code, Rider and so on), it's not used for release package. launchSettings.json是 IDE(Visual Studio、Visual Studio Code、Rider 等)的设置,不用于发布包。

In the launchSettings.json it has set up about the Environment Variable, Port and so on.launchSettings.json它设置了环境变量、端口等。

You can easier to change its (port, runtime config) on different Environment by "Computer Environment" and Command Parameters.您可以通过“计算机环境”和命令参数更轻松地在不同环境中更改其(端口、运行时配置)。

You can see more about the parameter or how it affects in Visual Studio .您可以在 Visual Studio 中查看有关参数或其影响方式的更多信息。

If you actually wanna change the "setting for IDE" on difference Environment, it depends on how the IDE support you.如果您真的想在不同的环境中更改“IDE 设置”,这取决于 IDE 如何支持您。 I use Rider and it has setting for project/sln on different computer.我使用 Rider,它在不同的计算机上设置了项目/sln。

Launch settings is will not be there in artifacts folder.启动设置不会出现在 artifacts 文件夹中。 It's a reference to solution environment variable.它是对解决方案环境变量的引用。 In cloud we can also say App Settings.在云中,我们也可以说应用设置。

You can use environment variable ASPNETCORE_URLS .您可以使用环境变量ASPNETCORE_URLS

Example for Linux/Unix: Linux/Unix 示例:

ASPNETCORE_URLS="http://0.0.0.0:5000" ./Release/netcoreapp3.1/WebApplication1

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM