From 3a10e01f71f876f2c2f744e5e8fb863c7c336eed Mon Sep 17 00:00:00 2001 From: Raul Avila Catala Date: Fri, 21 Aug 2026 03:19:06 -0600 Subject: [PATCH 1/2] chore(templates): fix PackageIcon, auto-pack y NU5128 - ProjectTemplates.csproj: agrega PackageIcon logo_template.png, README.md, SuppressDependenciesWhenPacking y GeneratePackageOnBuild (elimina NU5128) - install-templates.ps1: Install-FromPackage ejecuta dotnet pack automaticamente si no hay .nupkg - slnx: incluye ProjectTemplates para build integrado - EasyWindowsApplication.csproj: normaliza whitespace ItemGroup Fixes #15 --- devtools/install-templates.ps1 | 20 ++++++ src/EasyWindowsApplication.slnx | 1 + .../EasyWindowsApplication.csproj | 8 +-- src/ProjectTemplates/ProjectTemplates.csproj | 63 ++++++++++++------- 4 files changed, 65 insertions(+), 27 deletions(-) diff --git a/devtools/install-templates.ps1 b/devtools/install-templates.ps1 index 255f8c2..458ed1e 100644 --- a/devtools/install-templates.ps1 +++ b/devtools/install-templates.ps1 @@ -186,6 +186,26 @@ function Install-FromPackage { $files = @(Get-ChildItem -Path $nupkgBase -Filter '*.nupkg' -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.Name -notmatch '\.(symbols|snupkg)\.nupkg$' }) + if ($files.Count -eq 0) { + Write-Host '' + Write-Host ' No se encontraron paquetes. Ejecutando dotnet pack...' -ForegroundColor DarkGray + + $csproj = Join-Path $TemplatesFolder 'ProjectTemplates.csproj' + & dotnet pack $csproj --configuration Release --output $nupkgBase + + if ($LASTEXITCODE -ne 0) { + Write-Host '' + Write-Host ' [ERROR] Fallo al empaquetar.' -ForegroundColor Red + Wait-BackToMenu + return + } + + Write-Host ' [OK] Paquete generado.' -ForegroundColor Green + + $files = @(Get-ChildItem -Path $nupkgBase -Filter '*.nupkg' -Recurse -ErrorAction SilentlyContinue | + Where-Object { $_.Name -notmatch '\.(symbols|snupkg)\.nupkg$' }) + } + $pkg = $null if ($files.Count -eq 0) { diff --git a/src/EasyWindowsApplication.slnx b/src/EasyWindowsApplication.slnx index c661db4..d759bce 100644 --- a/src/EasyWindowsApplication.slnx +++ b/src/EasyWindowsApplication.slnx @@ -2,6 +2,7 @@ + diff --git a/src/EasyWindowsApplication/EasyWindowsApplication.csproj b/src/EasyWindowsApplication/EasyWindowsApplication.csproj index c7abf5e..8f46634 100644 --- a/src/EasyWindowsApplication/EasyWindowsApplication.csproj +++ b/src/EasyWindowsApplication/EasyWindowsApplication.csproj @@ -31,13 +31,13 @@ - + True \ - - True - \ + + True + \ diff --git a/src/ProjectTemplates/ProjectTemplates.csproj b/src/ProjectTemplates/ProjectTemplates.csproj index e6490f2..e008e7a 100644 --- a/src/ProjectTemplates/ProjectTemplates.csproj +++ b/src/ProjectTemplates/ProjectTemplates.csproj @@ -1,28 +1,45 @@ - - netstandard2.0 - true - false - content - Template - EasyWindowsApplication.Templates - RandAMediaLabGroup.EasyWindowsApplication.Templates - 0.0.0 - cl2raul66 - RandAMediaLabGroup - Plantillas dotnet new (easywinapp / simpleeasywinapp) para el framework EasyWindowsApplication - template; win32; windows-application; easy-windows-application; easywinapp; simpleeasywinapp - MIT - True - https://github.com/cl2raul66/EasyWindowsApplication - https://github.com/cl2raul66/EasyWindowsApplication - + + netstandard2.0 + true + false + content + Template + EasyWindowsApplication.Templates - - - - - + MIT License + RandAMediaLabGroup.EasyWindowsApplication.Templates + 0.0.0 + cl2raul66 + RandAMediaLabGroup + Plantillas dotnet new (easywinapp / simpleeasywinapp) para el framework EasyWindowsApplication + template; win32; windows-application; easy-windows-application; easywinapp; simpleeasywinapp + True + https://github.com/cl2raul66/EasyWindowsApplication + https://github.com/cl2raul66/EasyWindowsApplication + logo_template.png + True + README.md + MIT + True + + + + + + + + + + + True + \ + + + True + \ + + \ No newline at end of file From 506514d97350583e37859802c1792129fc219488 Mon Sep 17 00:00:00 2001 From: Raul Avila Catala Date: Fri, 21 Aug 2026 03:19:22 -0600 Subject: [PATCH 2/2] chore(generators): enable nullable, ImplicitUsings y AnalyzerReleases - Habilita Nullable/ImplicitUsings, SuppressDependenciesWhenPacking - Agrega AnalyzerReleases.Shipped/Unshipped para EAWIN001/EAWIN002 - Refactor EasyBehaviorGenerator a primary constructors y anotaciones nullable --- .../EasyBehaviorGenerator.cs | 33 +++++++------------ .../EasyWindowsApplication.Generators.csproj | 22 ++++++++----- .../Properties/AnalyzerReleases.Shipped.md | 0 .../Properties/AnalyzerReleases.Unshipped.md | 6 ++++ 4 files changed, 31 insertions(+), 30 deletions(-) create mode 100644 src/EasyWindowsApplication.Generators/Properties/AnalyzerReleases.Shipped.md create mode 100644 src/EasyWindowsApplication.Generators/Properties/AnalyzerReleases.Unshipped.md diff --git a/src/EasyWindowsApplication.Generators/EasyBehaviorGenerator.cs b/src/EasyWindowsApplication.Generators/EasyBehaviorGenerator.cs index b1f4fa8..ec43c69 100644 --- a/src/EasyWindowsApplication.Generators/EasyBehaviorGenerator.cs +++ b/src/EasyWindowsApplication.Generators/EasyBehaviorGenerator.cs @@ -1,4 +1,4 @@ -#nullable disable + using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -128,7 +128,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) if (!enclosing.IsDefaultOrEmpty && enclosing[0] is not null) { - var enclosingInfo = enclosing[0]; + var enclosingInfo = enclosing[0]!; var ns = enclosingInfo.Namespace; var className = enclosingInfo.ClassName; @@ -304,7 +304,7 @@ private static bool IsViewControlCandidate(SyntaxNode node) return true; } - private static Location ExtractControlLocation(GeneratorSyntaxContext context) + private static Location? ExtractControlLocation(GeneratorSyntaxContext context) { var inv = (InvocationExpressionSyntax)context.Node; if (inv.Expression is not MemberAccessExpressionSyntax ma) @@ -333,7 +333,7 @@ private static Location ExtractControlLocation(GeneratorSyntaxContext context) return null; } - private static EnclosingTypeInfo ExtractEnclosingType(GeneratorSyntaxContext context) + private static EnclosingTypeInfo? ExtractEnclosingType(GeneratorSyntaxContext context) { var current = context.Node.Parent; while (current is not null) @@ -380,20 +380,12 @@ private static string SanitizeName(string name) return sb.ToString(); } - private readonly struct NamedInfo + private readonly struct NamedInfo(string name, string typeSymbol, bool isWindowType, Location location) { - public readonly string Name; - public readonly string TypeSymbol; - public readonly bool IsWindowType; - public readonly Location Location; - - public NamedInfo(string name, string typeSymbol, bool isWindowType, Location location) - { - Name = name; - TypeSymbol = typeSymbol; - IsWindowType = isWindowType; - Location = location; - } + public readonly string Name = name; + public readonly string TypeSymbol = typeSymbol; + public readonly bool IsWindowType = isWindowType; + public readonly Location Location = location; public override bool Equals(object obj) => obj is NamedInfo other && Name == other.Name && TypeSymbol == other.TypeSymbol && IsWindowType == other.IsWindowType; @@ -402,10 +394,9 @@ public override int GetHashCode() => (Name?.GetHashCode() ?? 0) ^ (TypeSymbol?.GetHashCode() ?? 0) ^ IsWindowType.GetHashCode(); } - private sealed class EnclosingTypeInfo + private sealed class EnclosingTypeInfo(string ns, string className) { - public readonly string Namespace; - public readonly string ClassName; - public EnclosingTypeInfo(string ns, string className) { Namespace = ns; ClassName = className; } + public readonly string Namespace = ns; + public readonly string ClassName = className; } } diff --git a/src/EasyWindowsApplication.Generators/EasyWindowsApplication.Generators.csproj b/src/EasyWindowsApplication.Generators/EasyWindowsApplication.Generators.csproj index dafac34..5fabcb6 100644 --- a/src/EasyWindowsApplication.Generators/EasyWindowsApplication.Generators.csproj +++ b/src/EasyWindowsApplication.Generators/EasyWindowsApplication.Generators.csproj @@ -2,14 +2,16 @@ netstandard2.0 - disable + enable enable + latest - true - $(NoWarn);RS2008 + true - true + true false + true + true True EasyWindowsApplication.Generators @@ -28,23 +30,25 @@ - + + True \ - + True \ - - + + - + + diff --git a/src/EasyWindowsApplication.Generators/Properties/AnalyzerReleases.Shipped.md b/src/EasyWindowsApplication.Generators/Properties/AnalyzerReleases.Shipped.md new file mode 100644 index 0000000..e69de29 diff --git a/src/EasyWindowsApplication.Generators/Properties/AnalyzerReleases.Unshipped.md b/src/EasyWindowsApplication.Generators/Properties/AnalyzerReleases.Unshipped.md new file mode 100644 index 0000000..5db0b9f --- /dev/null +++ b/src/EasyWindowsApplication.Generators/Properties/AnalyzerReleases.Unshipped.md @@ -0,0 +1,6 @@ +### New Rules + +Rule ID | Category | Severity | Notes +--------|----------|----------|-------------------- +EAWIN001 | EasyWindowsApplication | Error | +EAWIN002 | EasyWindowsApplication | Error |