|
28 | 28 | </ItemGroup> |
29 | 29 |
|
30 | 30 | <!-- |
31 | | - Stage the SDK '.winmd' files as projection inputs before the reference projection generator runs. |
32 | | - The metadata lives in the downloaded package's 'ref/netstandard2.0' folder. We exclude the union |
33 | | - 'Windows.winmd' (it would duplicate every contract) and the handful of contracts that the desktop |
34 | | - 'Microsoft.Windows.SDK.NET.Ref' package omits (phone/embedded/etc.), matching the official Windows |
35 | | - SDK projection build in 'WinRT.Sdk.Projection.csproj'. |
| 31 | + Stage the SDK '.winmd' files as projection inputs. The metadata lives in the downloaded package's |
| 32 | + 'ref/netstandard2.0' folder. We exclude the union 'Windows.winmd' (it would duplicate every contract) |
| 33 | + and the handful of contracts that the desktop 'Microsoft.Windows.SDK.NET.Ref' package omits |
| 34 | + (phone/embedded/etc.), matching the official Windows SDK projection build in 'WinRT.Sdk.Projection.csproj'. |
| 35 | +
|
| 36 | + These inputs are added statically (at evaluation time), exactly like the in-repo projection projects |
| 37 | + feed '@(CsWinRTInputs)' (e.g. 'src/Projections/*/*.csproj' and the sibling 'Projection/Projection.csproj'). |
| 38 | + Doing it statically instead of from a target keeps the inputs in place regardless of how the CsWinRT |
| 39 | + projection targets are factored: the 'Windows Metadata not provided or detected' check now runs in a |
| 40 | + private '_CsWinRTComputeProjectionRefGenInputs' target (a dependency of 'CsWinRTGenerateProjection'), so |
| 41 | + a 'BeforeTargets="CsWinRTGenerateProjection"' hook would add these inputs *after* that check has already |
| 42 | + run and failed. 'NuGetPackageRoot' and the restored '.winmd' files are both available at evaluation time |
| 43 | + (the smoke tests always run a full 'dotnet build', which restores first). |
36 | 44 | --> |
37 | | - <Target Name="_StageWindowsSdkContractsInputs" BeforeTargets="CsWinRTGenerateProjection"> |
| 45 | + <PropertyGroup> |
| 46 | + <_SdkContractsWinMDFolder>$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', '$(_SdkContractsPackageName)', '$(_SdkContractsPackageVersion)', 'ref', 'netstandard2.0'))</_SdkContractsWinMDFolder> |
| 47 | + </PropertyGroup> |
38 | 48 |
|
39 | | - <PropertyGroup> |
40 | | - <_SdkContractsWinMDFolder>$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', '$(_SdkContractsPackageName)', '$(_SdkContractsPackageVersion)', 'ref', 'netstandard2.0'))</_SdkContractsWinMDFolder> |
41 | | - </PropertyGroup> |
| 49 | + <ItemGroup> |
| 50 | + <CsWinRTInputs Include="$(_SdkContractsWinMDFolder)*.winmd" |
| 51 | + Exclude="$(_SdkContractsWinMDFolder)Windows.winmd; |
| 52 | + $(_SdkContractsWinMDFolder)Windows.Embedded.DeviceLockdown.DeviceLockdownContract.winmd; |
| 53 | + $(_SdkContractsWinMDFolder)Windows.Networking.NetworkOperators.NetworkOperatorsFdnContract.winmd; |
| 54 | + $(_SdkContractsWinMDFolder)Windows.Phone.PhoneContract.winmd; |
| 55 | + $(_SdkContractsWinMDFolder)Windows.Phone.StartScreen.DualSimTileContract.winmd; |
| 56 | + $(_SdkContractsWinMDFolder)Windows.UI.WebUI.Core.WebUICommandBarContract.winmd" /> |
| 57 | + </ItemGroup> |
42 | 58 |
|
| 59 | + <!-- |
| 60 | + Fail fast with a targeted message if the SDK metadata didn't restore, before the projection generator |
| 61 | + reports the generic 'Windows Metadata not provided or detected' error. Anchored to the standard |
| 62 | + 'PrepareForBuild' target (not a CsWinRT-internal one) so it stays independent of target ordering. |
| 63 | + --> |
| 64 | + <Target Name="_ValidateWindowsSdkContractsInputs" BeforeTargets="PrepareForBuild"> |
43 | 65 | <Error Condition="!Exists('$(_SdkContractsWinMDFolder)')" |
44 | 66 | Text="Windows SDK metadata folder not found at '$(_SdkContractsWinMDFolder)'. Check that the PackageDownload for $(_SdkContractsPackageName) $(_SdkContractsPackageVersion) succeeded." /> |
45 | | - |
46 | | - <ItemGroup> |
47 | | - <CsWinRTInputs Include="$(_SdkContractsWinMDFolder)*.winmd" |
48 | | - Exclude="$(_SdkContractsWinMDFolder)Windows.winmd; |
49 | | - $(_SdkContractsWinMDFolder)Windows.Embedded.DeviceLockdown.DeviceLockdownContract.winmd; |
50 | | - $(_SdkContractsWinMDFolder)Windows.Networking.NetworkOperators.NetworkOperatorsFdnContract.winmd; |
51 | | - $(_SdkContractsWinMDFolder)Windows.Phone.PhoneContract.winmd; |
52 | | - $(_SdkContractsWinMDFolder)Windows.Phone.StartScreen.DualSimTileContract.winmd; |
53 | | - $(_SdkContractsWinMDFolder)Windows.UI.WebUI.Core.WebUICommandBarContract.winmd" /> |
54 | | - </ItemGroup> |
55 | 67 | </Target> |
56 | 68 | </Project> |
0 commit comments