.net - 你能在 VS2015 中转换 *.json 文件吗

标签 .net visual-studio-2015

我正在试用 VS2015 的所有新功能,我想知道我是否仍然可以对 project.json 或 config.json 文件应用转换?就像我们可以用 web.config => web.Debug.config 和 web.Release.config 做的一样。

最佳答案

以防万一其他人遇到这个。虽然你不能做 XDT 转换。使用 Config.json,您可以添加特定于环境的配置。

// Setup configuration sources.
var configuration = new Configuration()
    .AddJsonFile("config.json")
    .AddJsonFile($"config.{env.EnvironmentName}.json", optional: true);

if (env.IsEnvironment("Development"))
{
    // This reads the configuration keys from the secret store.
    // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
    configuration.AddUserSecrets();
}
configuration.AddEnvironmentVariables();
Configuration = configuration;

Asp.Net 5.0 Docs -> Configuration

关于.net - 你能在 VS2015 中转换 *.json 文件吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27379183/

相关文章:

c# - 为什么 CLR ThreadPool 工作线程使用 LIFO 顺序处理来自本地队列的任务?

.net - 在 Framework 4.0 项目中使用 .NET Framework 4.5 dll

configuration - Xamarin/Visual Studio 2015 : Custom Proguard configuration

visual-studio-2015 - 如何删除 VS 2015 状态栏?

c - 将指针传递给文件时出错

.net - 添加到 Nhibernate 集合而不初始化集合

c# - 带有 DI 简单注入(inject)器的 log4net

c# - Excel在后面的代码中将数据添加到WorksheetPart

c# - 如何在 visual studio 2015 中查看 .NET Core 框架的源代码

c++ - 引用使用 Union