.net8 相关问题


NET8 MAUI ListView 选择项目为橙色

我过去问过这个问题,得到的答案是这是一个错误,它将在 NET8 中修复。 使用新版本的框架,问题仍然存在。当我跑步时...


NET8 NativeAOT:Type.GetProperties() 不适用于某些类型,但适用于其他类型!为什么?

我有一个使用 NET8 NativeAOT 成功发布的程序,但是 Type.GetProperties() 适用于某些类,其中属性 r 正确返回,但不适用于其他类,它不返回 pr...


net8 Blazor Web 应用程序中出现 AmbigeousMatchException

我在客户端 Blazor Web 应用程序中遇到 AmbigouslyMatchException 错误。错误消息显示“请求与多个端点匹配。匹配:后备 {*path:nonfile}”。我...


dotnet 工具安装在 sdk:8.0.100-bookworm-slim 中挂起

我正在将应用程序从 NET6 迁移到 NET8。该应用程序是在 dockerfile 中构建的。为了进行代码分析,dotnet 工具“dotnet-sonarscanner”安装在构建映像中。 在N...


taiwlind JavaScript 无法在 blazor .net8 中使用 @rendermode InteractiveWebAssembly 执行

我最近配置了一个具有自动渲染模式的 Blazor 项目,并结合了 Tailwind CSS。然而,在 Razor 页面中使用需要 flowbite.min.js 的组件时,我遇到了挑战...


研究新的.NET8 Blazor Web 应用程序。如何将 .js 添加到 .razor 页面?

应该很简单,但是我真的找不到将.js添加到项目中的方法。 我使用如下简单代码创建了一个 .razor 页面: @页面“/文本” @rendermodeInteractiveAuto @inj...


Github Action 构建部署 Docker .Net 8 WebApi 失败 - “程序不包含适合入口点的静态‘Main’方法”

我正在尝试完成 Github 操作,以使用 Docker 构建和部署我的 .Net8 Web API 到 Kubernetes。这是我当前用于工作流程的 yml 文件: 名称:部署到 DigitalOcean Kube...


应用程序打开时单击推送通知会导致其崩溃并显示“窗口已创建”.net8

我已在我的应用程序上设置了推送通知。 当我在打开应用程序的情况下单击通知时,它崩溃了: [mono-rt] [错误] 致命的未处理异常:System.InvalidOperationException:窗口已经...


Powershell:Github Actions 与 Gitub Codespace 的不同行为(找不到类型:验证包含此类型的程序集是否已加载)

我需要在 Github Actions 工作流程中构建和使用这个 NET8 crypto.dll 类库。但看在上帝的份上,我无法让它与 Powershell(核心)一起工作。 运行程序在 Ubuntu VM 上运行...


MAUI 应用程序在目标升级到 .NET8 后运行模拟器之前抛出错误

我有一个相当简单的.NET MAUI 应用程序,我正在 Win10 上的 Visual Studio 中开发它,然后通过在模拟器中运行它来测试它。它工作得很好,直到我将目标框架从 .NET7 升级到...


<ImplicitUsings>.NET8项目中,有漏洞吗?

使用MS提供的升级助手,我正在尝试将我的项目从.NET 6升级到8。 我注意到它被插入到我的项目文件的顶部:enabled 使用 MS 提供的升级助手,我正在尝试将我的项目从 .NET 6 升级到 8。 我注意到它被插入到我的项目文件的顶部:<ImplicitUsings>enabled</ImplicitUsings> 我的问题是:<ImplicitUsings>是否为我的项目提供任何可能的攻击媒介?我有一种感觉,图书馆可以通过这种方式被劫持。 有人有消息吗? 谢谢! 您的项目没有风险。它只是清理文件顶部的 using 声明。它不会添加任何对您的项目的引用。 它只是应用项目 SDK 指定的全局使用。 它一点也不脆弱。


MAUI 8 - 如何更改弹出背景叠加颜色?

使用 MAUI 7.0,下一个代码允许更改弹出背景叠加颜色,但该代码不适用于 MAUI 8.0 使用 MAUI 7.0,下一个代码允许更改弹出窗口背景覆盖颜色,但该代码不适用于 MAUI 8.0 <maui:MauiWinUIApplication x:Class="TestMaui8.WinUI.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:maui="using:Microsoft.Maui" xmlns:local="using:TestMaui8.WinUI"> <maui:MauiWinUIApplication.Resources> <Color x:Key="SystemAltMediumColor">Transparent</Color> <SolidColorBrush x:Key="SystemControlPageBackgroundMediumAltMediumBrush" Color="{StaticResource SystemAltMediumColor}" /> <SolidColorBrush x:Key="ContentDialogBackgroundThemeBrush" Color="{StaticResource SystemAltMediumColor}" /> <SolidColorBrush x:Key="ContentDialogDimmingThemeBrush" Color="{StaticResource SystemAltMediumColor}" /> <StaticResource x:Key="ContentDialogBackground" ResourceKey="SystemControlPageBackgroundMediumAltMediumBrush" /> <StaticResource x:Key="PopupLightDismissOverlayBackground" ResourceKey="SystemControlPageBackgroundMediumAltMediumBrush" /> <SolidColorBrush x:Key="SliderBorderBrush" Color="#1A73E8" /> <Style TargetType="Slider"> <Setter Property="BorderBrush" Value="{StaticResource SliderBorderBrush}"/> </Style> </maui:MauiWinUIApplication.Resources> </maui:MauiWinUIApplication> 有人知道为什么它不起作用以及如何修复它吗? 更新添加一些图片 CommunityToolkit Popup 没有 Overlay color 功能。您可以在 CommunityToolkit GitHub 页面上提出功能请求。 是的,您发布的上述代码曾经可以工作,但它不适用于具有最新 CommunityToolkit.Maui nuget 的 .NET8。 但是如果您想更改叠加颜色,这里有一个解决方法。 <toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui" ... Color="Black" xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" > //make the size to be the full screen size <ContentView WidthRequest="1920" HeightRequest="1080"> <VerticalStackLayout WidthRequest="300" HeightRequest="300" BackgroundColor="Green"> <Image Source="dotnet_bot.png"/> <Label Text="Welcome to .NET MAUI!" VerticalOptions="Center" HorizontalOptions="Center" /> </VerticalStackLayout> </ContentView> </toolkit:Popup>


棱镜:ViewModelLocator.AutowireViewModel 不适用于内容视图

我正在将使用 Prism 的 Xamarin.Forms 应用程序迁移到 .NET Maui。该应用程序有一个 TabbedPage 导航。此迁移有效。 但是 ContentPages 包含几个 ContentView,如下所示: 我正在将使用 Prism 的 Xamarin.Forms 应用程序迁移到 .NET Maui。该应用程序有一个 TabbedPage 导航。此迁移有效。 但是 ContentPages 包含几个 ContentView,如下所示: <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:views="clr-namespace:MauiDemo.Views" x:Class="MauiDemo.Views.HomePage" Title="HomePage"> <VerticalStackLayout> <views:FirstContentView HeightRequest="200"/> <views:SecondContentView HeightRequest="200"/> </VerticalStackLayout> </ContentPage> 在 Xamarin 中,我能够将 prism:ViewModelLocator.Autowire="true" 属性添加到 contentview 中,并且 prism 找到了关联的视图模型。在 .NET maui 中,prism:ViewModelLocator.AutowireViewModel="Automatic" 属性没有任何作用。 例如,ContentView 的名称是 “FirstContentView”。关联的viewModel的名称是“FirstContentViewViewModel” 根据https://prismlibrary.com/docs/maui/migration.html中的描述,它应该可以工作,但事实并非如此。 配置这样的自动接线有什么技巧吗? 我使用 prism 存储库的当前克隆 https://github.com/PrismLibrary/Prism 以及带有最新 MAUI 组件的当前 .NET8 SDK 我使用区域而不是通过自动装配。具有不同 ContentView 的页面应该如下所示 <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:views="clr-namespace:MauiDemo.Views" xmlns:prism="http://prismlibrary.com" x:Class="MauiDemo.Views.HomePage" Title="HomePage"> <VerticalStackLayout> <ContentView prism:RegionManager.RegionName="FirstContent"/> <ContentView prism:RegionManager.RegionName="SecondContent"/> </VerticalStackLayout> </ContentPage> 所需的视图及其视图模型应在 MauiProgram 中注册为 RegisterForRegionNavigation container.RegisterForRegionNavigation<FirstContentView, FirstContentViewViewModel>(); container.RegisterForRegionNavigation<SecondContentView, SecondContentViewModel>(); .UsePrism(prism => { prism.RegisterTypes(container => { container.RegisterForNavigation<MainPage,MainPageViewModel>(); container.RegisterForNavigation<HomePage>(); container.RegisterForRegionNavigation<FirstContentView, FirstContentViewViewModel>(); container.RegisterForRegionNavigation<SecondContentView, SecondContentViewModel>(); }) .CreateWindow(navigationService => navigationService.CreateBuilder() .AddSegment<MainPage>() .NavigateAsync(HandleNavigationError)); }) 包含多个ContentView的页面的ViewModel应该为所需的ContentView调用RegionManager.RequestNavigate方法。 public class HomePageViewModel : ViewModelBase, IInitialize { private readonly IRegionManager _regionManager; public HomePageViewModel(IRegionManager regionManager) { _regionManager = regionManager; } public void Initialize(INavigationParameters parameters) { _regionManager.RequestNavigate("FirstContent", nameof(FirstContentView)); _regionManager.RequestNavigate("SecondContent", nameof(SecondContentView)); } } 仅此而已。它的工作原理如https://xamgirl.com/prism-regions-in-xamarin-forms/所述


© www.soinside.com 2019 - 2024. All rights reserved.