picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.52k stars 319 forks source link

C# template doesn't compile #2619

Closed kztk-m closed 4 months ago

kztk-m commented 4 months ago

Expected Behavior

Projects generated by dotnet new etoapp compile.

Actual Behavior

dotnet build fails due to the error "error CS0246: The type or namespace name 'Form' could not be found" in MainForm.cs.

It seems to me that this behavior is caused by 1c353b7, which removes some usings in favor of global using. The commit also removed the using declarations from the template code, but it seems to me that neither the nuget nor the .csproj files in the template sets up global usings for the code.

To be clear, I was not troubled with making the generated compile itself; I can add using Eto.Forms and some other usings in the generated .cs files to remove the errors.

Steps to Reproduce the Problem

  1. dotnet new install Eto.Forms.Templates to install the latest template (2.8.2).
  2. mkdir SomeProj and cd SomeProj
  3. dotnet new etoapp
  4. dotnet build SomeProj, which fails with the above-mentioned error.

Specifications

cwensley commented 4 months ago

Hey @kztk-m,

Thanks for reporting the issue! Yeah it's an oversight, perhaps I should add some tests for the templates on the CI builds to avoid this in the future.

photex commented 4 months ago

Howdy! I'm entirely new to this project and have hit this issue. For the sake of those like me, would someone be willing to share what usings are missing?

photex commented 4 months ago

Ok, I realize now that the link in the original report shows all the possible missing using statements.

I had to add:

using System; // in Program.cs
using Eto.Forms;
using Eto.Drawing;
phoyd commented 4 months ago

This problem seems there even when downgrading to Eto.Forms.Templates::2.8.0. I've downgraded to 2.7.5 now and use https://github.com/dotnet-outdated/dotnet-outdated to upgrade the packages.