Skip to content

Commit 5654c29

Browse files
teo-tsirpanisgithub-actions
authored andcommitted
Run AddImplicitDefineConstants after PrepareForBuild.
1 parent ccd64de commit 5654c29

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,17 +252,17 @@ Copyright (c) .NET Foundation. All rights reserved.
252252
</Target>
253253

254254
<!--
255-
Add implicitly defined preprocessor symbols to DefineConstants. Note: this is intentionally using 'BeforeCompile' as
255+
Add implicitly defined preprocessor symbols to DefineConstants. Note: this is intentionally using 'PrepareForBuild' as
256256
trigger to ensure that it runs before the XamlPreCompile targets. This targets creates the intermediate XAML project
257257
that is used by some XAML-based UI frameworks (eg. UWP XAML, WinUI 3). If it runs before AddImplicitDefineConstants,
258258
and the code has any '#ifdefs' on constants generated by this target (eg. 'NET9_0_OR_GREATER'), the intermediate XAML
259259
project will end up selecting the other code paths instead, which can cause all kinds of build failures or other
260260
problems. For additional context, see: https://github.com/dotnet/sdk/issues/43908.
261261
-->
262-
<Target Name="AddImplicitDefineConstants"
262+
<Target Name=""
263263
Condition=" '$(DisableImplicitFrameworkDefines)' != 'true' "
264264
DependsOnTargets="GenerateTargetPlatformDefineConstants;GenerateNETCompatibleDefineConstants;GeneratePlatformCompatibleDefineConstants;_DisableDiagnosticTracing"
265-
BeforeTargets="BeforeCompile" >
265+
AfterTargets="PrepareForBuild" >
266266
<PropertyGroup>
267267
<DefineConstants Condition=" '@(_ImplicitDefineConstant)' != '' " >$(DefineConstants);@(_ImplicitDefineConstant)</DefineConstants>
268268
<FinalDefineConstants Condition=" '@(_ImplicitDefineConstant)' != '' and '$(Language)' == 'VB' " >$(FinalDefineConstants),@(_ImplicitDefineConstant->'%(Identity)=-1', ',')</FinalDefineConstants>

0 commit comments

Comments
 (0)