-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move some of the require props into Core and fix #6529 #6767
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,12 @@ | |
<MSBuildWarningsAsMessages Condition=" '$(TargetPlatformIdentifier)' == 'Android' ">$(MSBuildWarningsAsMessages);XA4218</MSBuildWarningsAsMessages> | ||
</PropertyGroup> | ||
|
||
<Import Project="WinUI.targets" Condition=" '$(TargetPlatformIdentifier)' == 'windows' " /> | ||
<!-- | ||
This double check seems excessive, but importing the WinUI.targets when building for windows is not | ||
sufficient. The WASDK targets assume everything is WinUI and thus just passes along the TFM of the app. | ||
As a result, if you have a net6.0 class library, the app will call MSBuild on that library - with the Windows TFM! | ||
This results in the $(TargetPlatformIdentifier) condition being met - even though there are no WASK targets to run! | ||
--> | ||
<Import Project="WinUI.targets" Condition=" '$(TargetPlatformIdentifier)' == 'windows' and '$(WindowsAppSDKWinUI)' == 'true'" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sure that when this target is imported it is BOTH a windows project AND it is referencing the WASDK nuget. If MSBuild is run with a TargetFramework of windows, the first condition will become true, but the second one will not because the real project will not have referenced the WASDK nuget. And this is fine because all the targets in the WinUI.targets are workarounds for windows AND WASDK nuget together. |
||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,14 @@ | |
<UsingMicrosoftMauiCoreSdk>true</UsingMicrosoftMauiCoreSdk> | ||
</PropertyGroup> | ||
|
||
<!-- Set some property defaults that MAUI requires - especially for dotnet build to work --> | ||
<PropertyGroup Condition=" '$([MSBuild]::GetTargetPlatformIdentifier($(TargetFramework)))' == 'windows' "> | ||
<EnableMsixTooling Condition=" '$(EnableMsixTooling)' == '' ">true</EnableMsixTooling> | ||
<EnablePreviewMsixTooling Condition=" '$(EnablePreviewMsixTooling)' == '' ">$(EnableMsixTooling)</EnablePreviewMsixTooling> | ||
<GenerateLibraryLayout Condition=" '$(GenerateLibraryLayout)' == '' and '$(EnableMsixTooling)' == 'true' and '$(OutputType)' != 'Exe' and '$(OutputType)' != 'WinExe' ">true</GenerateLibraryLayout> | ||
<WinUISDKReferences Condition=" '$(WinUISDKReferences)' == '' and '$(EnableMsixTooling)' == 'true' ">false</WinUISDKReferences> | ||
</PropertyGroup> | ||
Comment on lines
+8
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved these properties to here to reduce the required properties in class libraries that use maui but do not set single project and target windows:
|
||
|
||
<!-- Imported last --> | ||
<PropertyGroup> | ||
<AfterMicrosoftNETSdkTargets>$(AfterMicrosoftNETSdkTargets);$(MSBuildThisFileDirectory)Microsoft.Maui.Core.Sdk.After.targets</AfterMicrosoftNETSdkTargets> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might also need to be moved as a result of microsoft/WindowsAppSDK#2456 - along with WindowsPackageType