forked from dotnet/maui
-
Notifications
You must be signed in to change notification settings - Fork 47
Labels
bugSomething isn't workingSomething isn't working
Description
Description
I modified the template created by dotnet new maui to see if it could be used with Gtk. I added all currently available GtkSharp.Maui.** packages and the GtkSharp main package as dependencies. I based the Gtk startup setup on the Controls.Sample from the maui-linux repository.
However, when I tried to run the project, I encountered an error stating that MauiGtkApplication could not be found.
Steps to Reproduce
- Create maui template app (
dotnet new maui) - Replace files
*.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-gtk</TargetFrameworks>
<!--
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
-->
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net9.0-tizen</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>MauiTemplate</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- Display name -->
<ApplicationTitle>MauiTemplate</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.companyname.mauitemplate</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>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
-->
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="GtkSharp" Version="3.24.24.117-develop" />
<PackageReference Include="GtkSharp.Maui.Resizetizer" Version="8.0.40--date20250228-1034.git-cd7b73d" />
<PackageReference Include="GtkSharp.Maui.Core" Version="8.0.40--date20250228-1034.git-cd7b73d" />
<PackageReference Include="GtkSharp.Maui.Graphics" Version="8.0.40--date20250228-1034.git-cd7b73d" />
<PackageReference Include="GtkSharp.Maui.Essentials" Version="8.0.40--date20250228-1034.git-cd7b73d" />
<PackageReference Include="GtkSharp.Maui.Controls.Compatibility" Version="8.0.40--date20250228-1034.git-cd7b73d" />
<PackageReference Include="GtkSharp.Maui.Controls.Xaml" Version="8.0.40--date20250228-1034.git-cd7b73d" />
<PackageReference Include="GtkSharp.Maui.Controls.Core" Version="8.0.40--date20250228-1034.git-cd7b73d" />
<PackageReference Include="GtkSharp.Maui.Graphics.Skia" Version="8.0.40--date20250228-1034.git-cd7b73d" />
<PackageReference Include="GtkSharp.Maui.Graphics.Gtk" Version="8.0.40--date20250228-1034.git-cd7b73d" />
<PackageReference Include="GtkSharp.Maui.Graphics.Text.Markdig" Version="8.0.40--date20250228-1034.git-cd7b73d" />
<PackageReference Include="GtkSharp.Maui.Controls.Build.Tasks" Version="8.0.40--date20250228-1034.git-cd7b73d" />
<PackageReference Include="GtkSharp.Maui.AspNetCore.Components.WebView" Version="8.0.40--date20250228-1034.git-cd7b73d" />
<PackageReference Include="GtkSharp.Maui.AspNetCore.Components.WebView.Gtk" Version="8.0.40--date20250228-1034.git-cd7b73d" />
<!--
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
-->
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
</ItemGroup>
</Project>Program.cs (instead of Platforms/Gtk/Main.cs)
using System;
using Microsoft.Maui;
using Microsoft.Maui.Hosting;
namespace MauiTemplate;
class Program : MauiGtkApplication
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
static void Main(string[] args)
{
var app = new Program();
app.Run(args);
}
}- Run
dotnet run -f=net8.0-gtk - Error
Link to public reproduction project repository
No response
Version with bug
8.0.408
Is this a regression from previous behavior?
No, this is something new, Not sure, did not test other versions
Last version that worked well
8.0.408
Affected platforms
Other (Tizen, Linux, etc. not supported by Microsoft directly)
Affected platform versions
No response
Did you find any workaround?
No, yet.
Relevant log output
> dotnet run -f=net8.0-gtk
# Error:
/home/lemon73/Repo/maui-linux/MauiTemplate/Program.cs(7,17): error CS0246: The type or namespace name 'MauiGtkApplication' could not be found (are you missing a using directive or an assembly reference?) [/home/lemon73/Repo/maui-linux/MauiTemplate/MauiTemplate.csproj::TargetFramework=net8.0-gtk]
The build failed. Fix the build errors and run again.Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working