forked from roslynpad/roslynpad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Directory.Build.targets
24 lines (24 loc) · 1.19 KB
/
Directory.Build.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<Target Name="UpdateAppSettings" AfterTargets="Build;Publish"
Condition=" '$(UpdateAppSettings)' == 'true' and Exists('$(MSBuildProjectDirectory)\appsettings.json') ">
<PropertyGroup>
<AppSettingsInputFile>$(MSBuildProjectDirectory)\appsettings.json</AppSettingsInputFile>
<AppSettingsOriginalString>"InstrumentationKey": ""</AppSettingsOriginalString>
<AppSettingsReplaceString>"InstrumentationKey": "$(RoslynPadTelemetryKey)"</AppSettingsReplaceString>
</PropertyGroup>
<WriteLinesToFile
File="$(OutDir)\appsettings.json"
Lines="$([System.IO.File]::ReadAllText($(AppSettingsInputFile)).Replace($(AppSettingsOriginalString), $(AppSettingsReplaceString)))"
Overwrite="true"
Encoding="Unicode"/>
<WriteLinesToFile
Condition=" '$(PublishDir)' != '' "
File="$(PublishDir)\appsettings.json"
Lines="$([System.IO.File]::ReadAllText($(AppSettingsInputFile)).Replace($(AppSettingsOriginalString), $(AppSettingsReplaceString)))"
Overwrite="true"
Encoding="Unicode"/>
</Target>
</Project>