首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >根据构建配置选择launchSettings.json配置文件

根据构建配置选择launchSettings.json配置文件
EN

Stack Overflow用户
提问于 2020-05-18 17:58:23
回答 1查看 194关注 0票数 0

我需要根据选择的构建配置从launchSettings.json中选择配置文件。假设我有build config Debug,Debug-2,我需要从launchSettings.json中为它们选择不同的配置文件。有没有办法做到这一点?

EN

回答 1

Stack Overflow用户

发布于 2021-05-15 00:51:58

在构建过程中,我使用“复制”MSBuild任务用调试版本或发布版本覆盖launchSettings.json:

代码语言:javascript
复制
  <ItemGroup>
    <UpToDateCheckInput Include="Properties/launchSettings.$(Configuration).json" />
  </ItemGroup>

  <Target Name="CleanLaunchSettings" AfterTargets="Clean">
    <Message Importance="high" Text="Deleting launchSettings.json..." />
    <Delete Files="Properties/launchSettings.json" />
  </Target>

  <Target Name="CopyLaunchSettings" AfterTargets="Build" Inputs="Properties/launchSettings.$(Configuration).json" Outputs="Properties/launchSettings.json">
    <Message Importance="high" Text="Copying launchSettings.$(Configuration).json..." />
    <Copy SourceFiles="Properties/launchSettings.$(Configuration).json" DestinationFiles="Properties/launchSettings.json" />
  </Target>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61867007

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档