Program.cs(18, 44): [CS1061] 'AppBuilder'不包含“UsePlatformDetect”的定义;并且没有可访问的扩展方法“UsePlatformDetect”
Program.cs(18, 44): [CS1061] 'AppBuilder' does not contain a definition for 'UsePlatformDetect' and no accessible extension method 'UsePlatformDetect' accepting a first argument of type 'AppBuilder' could be found (are you missing a using directive or an assembly reference?)
所以这是我的代码:
using System;
using Avalonia;
using Avalonia.ReactiveUI;
namespace AvaloniaCrossPlatformApplication1.Desktop
{
class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>().UsePlatformDetect()
.LogToDebug()
.UseReactiveUI();
}
}
我的 avalonia 版本是 avalonia.0.10.13.nupkg.sha512
我正在使用基本模板。
Avalonia 上好像没有 UsePlatformDetect...
我用了 jetbrain rider & 。 dotnet new -i Avalonia.Templates
生成模板。
有什么想法吗?我在 ubuntu 22.04 上。
问候
Program.cs(18, 44): [CS1061] 'AppBuilder' does not contain a definition for 'UsePlatformDetect' and no accessible extension method 'UsePlatformDetect' accepting a first argument of type 'AppBuilder' could be found (are you missing a using directive or an assembly reference?)
So here is my code :
using System;
using Avalonia;
using Avalonia.ReactiveUI;
namespace AvaloniaCrossPlatformApplication1.Desktop
{
class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>().UsePlatformDetect()
.LogToDebug()
.UseReactiveUI();
}
}
My avalonia version is avalonia.0.10.13.nupkg.sha512
i'am using the basic template.
It seems that there is no UsePlatformDetect on Avalonia ...
I used jetbrain rider & dotnet new -i Avalonia.Templates
to generate the template.
Any ideas ? I'am on ubuntu 22.04.
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
UsePlatformDetect
扩展在Avalonia.Desktop
程序集中有其定义,因此您必须在.csproj
中添加对其的引用The
UsePlatformDetect
extension has its definition in theAvalonia.Desktop
assembly, so you have to add a reference to it in your.csproj