[英]Can a profile from the launchSettings.json file be loaded when running unit tests?
[英]Choose launchSettings.json profile based on build configuration
我需要根據選擇的構建配置從 launchSettings.json 中選擇配置文件。 假設我已經構建了 Debug、Debug-2 配置,我需要從 launchSettings.json 中為它們中的每一個選擇不同的配置文件。 有沒有辦法做到這一點?
我使用“復制”MSBuild 任務在構建期間使用調試或發布版本覆蓋 launchSettings.json:
<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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.