|
1 | 1 | <Project>
|
2 | 2 | <Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
|
| 3 | + <Import Project="eng\targets\Imports.targets" /> |
3 | 4 | <Import Project="eng\targets\NuGet.targets" />
|
4 | 5 | <Import Project="eng\targets\NGenBinaries.targets" />
|
5 | 6 | <Import Project="FSharp.Profiles.props" />
|
6 | 7 |
|
7 |
| - <PropertyGroup> |
8 |
| - <CompileDependsOn>$(CompileDependsOn);CopyAndSubstituteTextFiles</CompileDependsOn> |
9 |
| - </PropertyGroup> |
10 |
| - |
11 | 8 | <Target Name="CopyAndSubstituteTextFiles"
|
12 | 9 | Inputs="@(CopyAndSubstituteText)"
|
13 |
| - Outputs="@(CopyAndSubstituteText->'$(OutDir)%(TargetFilename)')"> |
| 10 | + Outputs="@(CopyAndSubstituteText->'$(IntermediateOutputPath)%(Filename)%(Extension)')" |
| 11 | + BeforeTargets="BeforeBuild"> |
| 12 | + |
14 | 13 | <PropertyGroup>
|
| 14 | + <__TargetFilePath>@(CopyAndSubstituteText->'$(IntermediateOutputPath)%(Filename)%(Extension)')</__TargetFilePath> |
| 15 | + <__TargetFileName>@(CopyAndSubstituteText->'%(Filename)%(Extension)')</__TargetFileName> |
| 16 | + |
15 | 17 | <_ReplacementText>$([System.IO.File]::ReadAllText('%(CopyAndSubstituteText.FullPath)'))</_ReplacementText>
|
16 | 18 | <_ReplacementText Condition="'%(CopyAndSubstituteText.Pattern1)' != ''">$(_ReplacementText.Replace('%(CopyAndSubstituteText.Pattern1)', '%(CopyAndSubstituteText.Replacement1)'))</_ReplacementText>
|
17 | 19 | <_ReplacementText Condition="'%(CopyAndSubstituteText.Pattern2)' != ''">$(_ReplacementText.Replace('%(CopyAndSubstituteText.Pattern2)', '%(CopyAndSubstituteText.Replacement2)'))</_ReplacementText>
|
18 | 20 | </PropertyGroup>
|
19 |
| - <WriteLinesToFile File="$(OutDir)%(CopyAndSubstituteText.TargetFilename)" Lines="$(_ReplacementText)" Overwrite="true" /> |
| 21 | + |
| 22 | + <MakeDir |
| 23 | + Directories="$(IntermediateOutputPath)" |
| 24 | + Condition="!Exists('$(IntermediateOutputPath)')" /> |
| 25 | + <WriteLinesToFile File="$(__TargetFilePath)" Lines="$(_ReplacementText)" Overwrite="true" WriteOnlyWhenDifferent="true" /> |
| 26 | + |
| 27 | + <!-- Make sure it will get cleaned --> |
| 28 | + <ItemGroup > |
| 29 | + <None Include="$(__TargetFilePath)" Condition="'$(__TargetFileName)' == 'App.config'" CopyToOutputDirectory="Never" /> |
| 30 | + <None Include="$(__TargetFilePath)" Condition="'$(__TargetFileName)' != 'App.config'" CopyToOutputDirectory="PreserveNewest" /> |
| 31 | + <FileWrites Include="$(__TargetFilePath)" Condition="'$(__TargetFileName)' != 'App.config'" /> |
| 32 | + </ItemGroup> |
| 33 | + </Target> |
| 34 | + |
| 35 | + <Target Name="_GenerateBuildPropertiesFile" |
| 36 | + Outputs="$(IntermediateOutputPath)buildproperties.fs" |
| 37 | + BeforeTargets="BeforeBuild" |
| 38 | + Condition="'$(Language)'=='F#'"> |
| 39 | + |
| 40 | + <ItemGroup> |
| 41 | + <_BuildPropertyLines Remove="@(_BuildPropertyLines)" /> |
| 42 | + <_BuildPropertyLines Include="// <auto-generated >" /> |
| 43 | + <_BuildPropertyLines Include="// <Generated by the FSharp WriteCodeFragment class./>" /> |
| 44 | + <_BuildPropertyLines Include="// </auto-generated/>" /> |
| 45 | + <_BuildPropertyLines Include="//" /> |
| 46 | + <_BuildPropertyLines Include="module internal FSharp.BuildProperties" /> |
| 47 | + <_BuildPropertyLines Include="let fsProductVersion = "$(FSPRODUCTVERSION)"" /> |
| 48 | + <_BuildPropertyLines Include="let fsLanguageVersion = "$(FSLANGUAGEVERSION)"" /> |
| 49 | + </ItemGroup> |
| 50 | + |
| 51 | + <MakeDir |
| 52 | + Directories="$(IntermediateOutputPath)" |
| 53 | + Condition="!Exists('$(IntermediateOutputPath)')" /> |
| 54 | + <WriteLinesToFile File="$(IntermediateOutputPath)buildproperties.fs" Lines="@(_BuildPropertyLines)" Overwrite="true" WriteOnlyWhenDifferent="true" /> |
| 55 | + |
20 | 56 | <!-- Make sure it will get cleaned -->
|
21 |
| - <CreateItem Include="$(OutDir)%(CopyAndSubstituteText.TargetFilename)"> |
22 |
| - <Output TaskParameter="Include" ItemName="FileWrites" /> |
23 |
| - </CreateItem> |
| 57 | + <ItemGroup> |
| 58 | + <FileWrites Include="$(IntermediateOutputPath)buildproperties.fs" /> |
| 59 | + <CompileBefore Include="$(IntermediateOutputPath)buildproperties.fs" /> |
| 60 | + </ItemGroup> |
24 | 61 | </Target>
|
25 | 62 |
|
26 | 63 | </Project>
|
0 commit comments