2 ***********************************************************************************************
3 Microsoft.NET.Sdk.targets
5 WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
6 created a backup copy. Incorrect changes to this file will make it
7 impossible to load or build your projects from the command-line or the IDE.
9 Copyright (c) .NET Foundation. All rights reserved.
10 ***********************************************************************************************
12 <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
15 <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
18 <Import Project="..\build\Microsoft.NET.Sdk.Common.targets"/>
21 ============================================================
24 This is the Publish target for cross-targeting.
25 Currently it is unsupported to publish for multiple target frameworks
26 because users can specify the $(PublishDir), and publish would put
27 multiple published applications in a single directory.
28 ============================================================
30 <Target Name="Publish">
31 <Error Text="The 'Publish' target is not supported without specifying a target framework. The current project targets multiple frameworks, please specify the framework for the published application." />
35 ============================================================
36 GetAllRuntimeIdentifiers
38 Outer build implementation of GetAllRuntimeIdentifiers returns
39 a union of all runtime identifiers used across inner and outer
42 It is further set to run before '_GenerateRestoreProjectSpec'
43 (note that running only 'Restore' is too late and will not work
44 with solution level restore). This ensures that any conditioning
45 of runtime identifiers against TargetFramework does not prevent
46 restore from providing the necessary RID-specific assets for all
49 It also brings parity to VS vs. command line behavior in this
50 scenario because VS passes all of the information from each
51 configured inner build to restore, whereas command-line restore
52 without this target would only use the runtime identifiers that
53 are statically set in the outer evaluation.
54 ============================================================
56 <Target Name="GetAllRuntimeIdentifiers"
57 Returns="$(RuntimeIdentifiers)"
58 BeforeTargets="_GenerateRestoreProjectSpec">
61 <_GetAllRuntimeIdentifiersTargetFrameworks Include="$(TargetFrameworks)" />
62 <_AllRuntimeIdentifiers Include="$(RuntimeIdentifiers);$(RuntimeIdentifier)" />
65 <MSBuild Projects="$(MSBuildProjectFile)"
66 Targets="GetAllRuntimeIdentifiers"
67 Properties="TargetFramework=%(_GetAllRuntimeIdentifiersTargetFrameworks.Identity)">
68 <Output ItemName="_AllRuntimeIdentifiers" TaskParameter="TargetOutputs" />
72 <RuntimeIdentifiers>@(_AllRuntimeIdentifiers->Distinct())</RuntimeIdentifiers>
77 ============================================================
80 Stub cross-targeting implementation of GetPackagingOutputs
81 to allow project references from from projects that pull in
82 Microsoft.AppxPackage.targets (UWP, PCL) to cross-targeted
85 Ultimately, the appx targets should be modified to use the
86 same P2P TFM negotiation protocol as Microsoft.Common.targets
87 so that they can forward to the TFM-specific GetPackagingOutputs
88 of the appropriate inner build. This stub would not have any
89 bad interaction with that change, which would happily bypass
90 this implementation altogether.
92 An empty GetPackagingOutputs is sufficient for the common
93 case of a library with no special assets to contribute to
94 the appx and is also equivalent to what is present in the
95 single-targeted case unless WindowsAppContainer is not set
98 Furthermore, the appx targets currently use continue-on-error
99 such that even without this, clean builds succeed but log an
100 error and incremental builds silently succeed. As such, this
101 simply removes a confounding error from successful clean
104 ============================================================
106 <Target Name="GetPackagingOutputs" />