-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
area-imageImage loading, sources, cachingImage loading, sources, cachingarea-xamlXAML, CSS, Triggers, BehaviorsXAML, CSS, Triggers, Behaviorss/needs-infoIssue needs more info from the authorIssue needs more info from the authort/bugSomething isn't workingSomething isn't working
Description
Description
i'm using MAUI to build an app, it can load image with debug mode, but can't load image with publish. the bug screen shot as bellow:
In debug mode, it's working 👍
in publish mode, it's not working !!!!!!! and make the CollectionView empty with Image tag
here is my code of page:
<Grid RowDefinitions="Auto,*,Auto"
ColumnDefinitions="*,Auto"
Padding="10">
<!-- 用户信息显示在右上角 -->
<!--<Label Grid.Row="0" Grid.Column="1"
x:Name="account"
Text="用户:张三"
FontSize="18"
HorizontalOptions="End"
VerticalOptions="Start" />-->
<!-- 中间显示已加入用户信息 -->
<Border Stroke="#526B52"
StrokeThickness="3" Padding="0"
StrokeShape="RoundRectangle 5"
MaximumHeightRequest="500">
<CollectionView ItemsSource="{Binding JoinedUsers}" x:Name="collectionView"
Margin="0,20,0,20" MaximumHeightRequest="500" VerticalScrollBarVisibility="Always" >
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical" VerticalItemSpacing="10"
Span="2" />
<!-- 每行显示2个卡片 -->
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame Padding="10" Margin="10"
HasShadow="True"
WidthRequest="150"
HeightRequest="150"
CornerRadius="75"
BackgroundColor="#F0F0F0">
<VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Center">
<!-- 用户头像 -->
<Image Source="{Binding AvatarUrl}"
WidthRequest="80"
HeightRequest="80"
Aspect="AspectFill"
VerticalOptions="Center"
Clip="Circle" />
<!-- 用户名 -->
<Label Text="{Binding UserName}"
FontSize="16"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="Center"
/>
<!-- 状态 -->
<Label Text="{Binding State}"
FontSize="14"
TextColor="Gray"
HorizontalOptions="Center"
VerticalOptions="Center"
/>
<!-- 操作按钮 -->
<!--<Button Text="私聊"
BackgroundColor="#4CAF50"
TextColor="White"
CornerRadius="10"
Clicked="OnUserActionClicked"
WidthRequest="100" />-->
</VerticalStackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Border>
<!-- 底部按钮:按住说话 -->
<Button Grid.Row="2" Grid.ColumnSpan="2"
BorderWidth="10"
x:Name="SpeakBtn"
Text="按住说话"
FontSize="Large"
BackgroundColor="#526B52"
CornerRadius="100"
HeightRequest="200"
WidthRequest="200"
Pressed="OnSpeakPressed"
Released="OnSpeakReleased"
VerticalOptions="End" />
</Grid>
And here is my code of .csproj:
<PropertyGroup>
<TargetFrameworks>net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
<!-- Note for MacCatalyst:
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
<OutputType>Exe</OutputType>
<RootNamespace>Speaker</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishTrimmed>false</PublishTrimmed>
<!-- Display name -->
<ApplicationTitle>Speaker</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.companyname.speaker</ApplicationId>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
<WindowsPackageType>None</WindowsPackageType>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<!--<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />-->
<MauiIcon Include="Resources\AppIcon\icons8.png"></MauiIcon>
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\speaker.svg" Color="#512BD4" BaseSize="128,128" />
<!--<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />-->
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<MauiImage Remove="Resources\Images\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0-rc.2.25502.107" />
<PackageReference Include="NAudio" Version="2.2.1" />
</ItemGroup>
<ItemGroup>
<MauiImage Include="Resources\Images\avatar_1.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Include="Resources\Images\avatar_2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Include="Resources\Images\avatar_f.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Include="Resources\Images\avatar_m.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Include="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
</ItemGroup>
<ItemGroup>
<Compile Update="LoginPage.xaml.cs">
<DependentUpon>LoginPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<MauiXaml Update="Pages\ChatPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
10.0.0-preview.1
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
No response
Did you find any workaround?
no
Relevant log output
Metadata
Metadata
Assignees
Labels
area-imageImage loading, sources, cachingImage loading, sources, cachingarea-xamlXAML, CSS, Triggers, BehaviorsXAML, CSS, Triggers, Behaviorss/needs-infoIssue needs more info from the authorIssue needs more info from the authort/bugSomething isn't workingSomething isn't working