summaryrefslogtreecommitdiff
path: root/.dotnet/sdk/3.0.100-preview6-012264/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.GenerateSupportedRuntime.targets
blob: 19d7680233560e1d43c44d6272c031a3cb4abe01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!--
***********************************************************************************************
Microsoft.NET.GenerateSupportedRuntime.targets

WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
          created a backup copy.  Incorrect changes to this file will make it
          impossible to load or build your projects from the command-line or the IDE.

Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <UsingTask TaskName="WriteAppConfigWithSupportedRuntime" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
  <UsingTask TaskName="SetGeneratedAppConfigMetadata" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />

  <PropertyGroup>
    <_GenerateSupportedRuntimeIntermediateAppConfig>$(IntermediateOutputPath)$(TargetFileName).withSupportedRuntime.config</_GenerateSupportedRuntimeIntermediateAppConfig>
  </PropertyGroup>

  <Target Name="GenerateSupportedRuntime"
          Condition="'$(GenerateSupportedRuntime)' != 'false' and '$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(HasRuntimeOutput)' == 'true'"
          DependsOnTargets="_WriteAppConfigWithSupportedRuntime"
          BeforeTargets="GenerateBindingRedirects">

    <SetGeneratedAppConfigMetadata
     AppConfigFile="@(AppConfigWithTargetPath)"
     TargetName="$(TargetFileName).config"
     GeneratedAppConfigFile="$(_GenerateSupportedRuntimeIntermediateAppConfig)"
      >

      <Output TaskParameter="OutputAppConfigFileWithMetadata" ItemName="_GenerateSupportedRuntimeAppConfigWithTargetPath" />
    </SetGeneratedAppConfigMetadata>

    <!--Override the AppConfigWithTargetPath for downstream target-->
    <ItemGroup>
      <AppConfigWithTargetPath Remove="@(AppConfigWithTargetPath)" />
      <AppConfigWithTargetPath Include="@(_GenerateSupportedRuntimeAppConfigWithTargetPath)" />
    </ItemGroup>

  </Target>

  <Target Name="_WriteAppConfigWithSupportedRuntime"
          Inputs="$(MSBuildAllProjects);@(AppConfigWithTargetPath)"
          Outputs="$(_GenerateSupportedRuntimeIntermediateAppConfig)"
          DependsOnTargets="PrepareForBuild">

    <WriteAppConfigWithSupportedRuntime
      AppConfigFile="@(AppConfigWithTargetPath)"
      TargetFrameworkIdentifier="$(TargetFrameworkIdentifier)"
      TargetFrameworkVersion="$(TargetFrameworkVersion)"
      TargetFrameworkProfile="$(TargetFrameworkProfile)"
      OutputAppConfigFile="$(_GenerateSupportedRuntimeIntermediateAppConfig)"
      >
    </WriteAppConfigWithSupportedRuntime>

    <ItemGroup>
      <FileWrites Include="@(_GenerateSupportedRuntimeAppConfigWithTargetPath)"/>
    </ItemGroup>

  </Target>

</Project>