Equivalent to App.config transforms for .NET Core?

爱⌒轻易说出口 提交于 2020-08-06 07:55:23

问题


I'm writing a .NET Core console application (NOT an ASP.NET Core web application). In .NET Framework I would have an App.config, and App.Debug.config, and an App.Release.config file, the latter 2 for transforming the former. This allowed me to change various settings based on whether I was creating a debug or a release build.

Now with .NET Core, you're meant to use appsettings.json instead. Fine, but how do I do my debug and release transforms with this? I've read something about using an environment variable to determine whether you're in a release or debug environment but I really don't want to do this and it's not really appropriate for console applications anyway. So how can I transform config files in a similar way to how it was done in .NET Framework?


回答1:


The short answer that I found to this is: use SlowCheetah. It implements XDT transformations for .NET Core and in addition allows JSON transformations too with JDT.



来源:https://stackoverflow.com/questions/53208920/equivalent-to-app-config-transforms-for-net-core

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!