You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WinUI 3 and UWP apps (perhaps WPF/MAUI ones too?) use the XamlPreCompile task defined in the .NET SDK, which creates the intermediate .dll necessary for XAML compilation. The AddImplicitDefineConstants target runs before 'CoreCompile', but this seems to be too late and after 'XamlPreCompile' has already run. This causes the intermediate XAML build to not see the _OR_GREATER defines, meaning it will fail when those are used to exclude incompatible code, and resulting in very weird errors for someone looking at the IDE (which will show the code as being completely fine).
I hit this while migrating the Microsoft Store to .NET 9.
Can we make this target use BeforeTargets="BeforeCompile" or something, to address this?
To Reproduce
Create a WinUI 3 or UWP .NET 9 app with the following code behind:
#if!NET8_0_OR_GREATER
#error GenerateNETCompatibleDefineConstants didn't run
#endif
Expected result
Should build as expected and match the behavior in the IDE.
Describe the bug
WinUI 3 and UWP apps (perhaps WPF/MAUI ones too?) use the XamlPreCompile task defined in the .NET SDK, which creates the intermediate .dll necessary for XAML compilation. The AddImplicitDefineConstants target runs before 'CoreCompile', but this seems to be too late and after 'XamlPreCompile' has already run. This causes the intermediate XAML build to not see the
_OR_GREATER
defines, meaning it will fail when those are used to exclude incompatible code, and resulting in very weird errors for someone looking at the IDE (which will show the code as being completely fine).I hit this while migrating the Microsoft Store to .NET 9.
Can we make this target use
BeforeTargets="BeforeCompile"
or something, to address this?To Reproduce
Create a WinUI 3 or UWP .NET 9 app with the following code behind:
Expected result
Should build as expected and match the behavior in the IDE.
Actual result
Further technical details
The text was updated successfully, but these errors were encountered: