-
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
Improve consistency with resizetizer #4367
Conversation
- no need for the Assets prefix on all Windows assets - Windows now respects LogicalName on @(MauiAsset)
@@ -279,12 +279,14 @@ | |||
|
|||
<Target Name="ProcessMauiAssets"> | |||
<PropertyGroup Condition="'$(_ResizetizerIsUWPApp)' == 'True' Or '$(_ResizetizerIsWindowsAppSdk)' == 'True'"> | |||
<_MauiAssetFolderName>Assets</_MauiAssetFolderName> |
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.
No more "Assets" prefix
<ItemGroup Condition="'$(_ResizetizerIsUWPApp)' == 'True' Or '$(_ResizetizerIsWindowsAppSdk)' == 'True'"> | ||
<!-- Windows does not recognize %(LogicalName), so we must copy it to %(Link) --> | ||
<MauiAsset Update="@(MauiAsset)" Link="%(MauiAsset.LogicalName)" Condition="'%(MauiAsset.Link)' == '' And '%(MauiAsset.LogicalName)' != ''" /> | ||
</ItemGroup> |
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.
Windows uses Link
and iOS/Android uses LogicalName
to determine the final destination.
xmlns:windows="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;assembly=Microsoft.Maui.Controls" | ||
xmlns:converters="clr-namespace:Controls.Sample.Converters" | ||
x:Class="Maui.Controls.Sample.XamlApp" | ||
windows:Application.ImageDirectory="Assets"> | ||
x:Class="Maui.Controls.Sample.XamlApp"> |
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.
The windows:Application.ImageDirectory="Assets"
is no longer needed by default.
|
||
<!-- Raw Assets (also remove the "Resources\Raw" prefix) --> | ||
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" /> |
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.
Example asset added to the template.
All, while editing the manifest file may be the correct thing to do, something with the template for preview 13 is incorrect. I went back and looked at a preview 12 project and it was exactly the same, but preview 12 worked... |
WINDOWS BREAKING CHANGE (see below)
Description of Change
Currently, certain parts of resizetizer are inconsistent across platforms, mainly Windows:
FileSystem.OpenAppPackageFileAsync
still required a#if WINDOWS
This PR attempts to fix #3270
After this PR, you will be able to do this:
Assume there is a asset added:
<MauiAsset Include="MyAsset.txt" />
<MauiAsset Include="MyAsset.txt" LogicalName="YourAsset.md" />
<MauiAsset Include="Resources\MyAsset.txt" LogicalName="YourAsset.md" />
*<MauiAsset Include="Assets\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
**Notes:
* Without the LogicalName, this will fail to build on iOS because the "Resources" root folder is illegal
** Wildcards can be used to move an entire subfolder to the root of the app package
Since all the files go into predictable locations for all platforms, Essentials can be used to read files:
Additions made
LogicalName
can optionally be used to control where in the app the asset will goOne reason for this is that often the folder name of "Resources" is used to contain resources, but this may not be desirable in the app package for a few reasons:
PR Checklist
Does this PR touch anything that might affect accessibility?
If any of the above checkboxes apply to your PR, then the PR will need to provide testing to demonstrate that accessibility still works.