From c0c1be887de10da1b8b831296f574fc812cc7f17 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 18 Dec 2025 13:08:26 +0000
Subject: [PATCH 1/4] Initial plan
From 094accd4e758d71dd4ffbea7fed797560711e65d Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 18 Dec 2025 13:16:08 +0000
Subject: [PATCH 2/4] Fix template files to end with newline and add test to
verify
Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
---
.../BlazorWebCSharp.1.Client/_Imports.razor | 2 +-
.../Components/Pages/NotFound.razor | 2 +-
.../BlazorWebCSharp.1/wwwroot/app.css | 2 +-
.../Pages/NotFound.razor | 2 +-
.../wwwroot/css/app.css | 2 +-
.../RazorPagesWeb-CSharp/wwwroot/css/site.css | 2 +-
.../StarterWeb-CSharp/wwwroot/css/site.css | 2 +-
.../StarterWeb-FSharp/wwwroot/css/site.css | 2 +-
.../.template.config/template.json | 2 +-
.../content/Worker-FSharp/Program.fs | 2 +-
.../test/Templates.Tests/NewlineEndingTest.cs | 95 +++++++++++++++++++
11 files changed, 105 insertions(+), 10 deletions(-)
create mode 100644 src/ProjectTemplates/test/Templates.Tests/NewlineEndingTest.cs
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1.Client/_Imports.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1.Client/_Imports.razor
index 674eac341d64..4b41f97fe01c 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1.Client/_Imports.razor
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1.Client/_Imports.razor
@@ -12,4 +12,4 @@
@using BlazorWebCSharp._1.Client
@*#if (UseWebAssembly && InteractiveAtRoot) -->
@using BlazorWebCSharp._1.Client.Layout
-##endif*@
\ No newline at end of file
+##endif*@
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Pages/NotFound.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Pages/NotFound.razor
index 917ada1d2328..091b6b8bc5ee 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Pages/NotFound.razor
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Pages/NotFound.razor
@@ -2,4 +2,4 @@
@layout MainLayout
Not Found
-Sorry, the content you are looking for does not exist.
\ No newline at end of file
+Sorry, the content you are looking for does not exist.
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/wwwroot/app.css b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/wwwroot/app.css
index f43d4d7b77ae..3902f865ad3f 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/wwwroot/app.css
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/wwwroot/app.css
@@ -59,4 +59,4 @@ h1:focus {
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
text-align: start;
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Pages/NotFound.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Pages/NotFound.razor
index 917ada1d2328..091b6b8bc5ee 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Pages/NotFound.razor
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Pages/NotFound.razor
@@ -2,4 +2,4 @@
@layout MainLayout
Not Found
-Sorry, the content you are looking for does not exist.
\ No newline at end of file
+Sorry, the content you are looking for does not exist.
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/wwwroot/css/app.css b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/wwwroot/css/app.css
index efef290c1836..7539aad8b93e 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/wwwroot/css/app.css
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/wwwroot/css/app.css
@@ -114,4 +114,4 @@ code {
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
text-align: start;
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/css/site.css b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/css/site.css
index 819f61241bb3..454265088e70 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/css/site.css
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/css/site.css
@@ -28,4 +28,4 @@ body {
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
text-align: start;
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/wwwroot/css/site.css b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/wwwroot/css/site.css
index 819f61241bb3..454265088e70 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/wwwroot/css/site.css
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/wwwroot/css/site.css
@@ -28,4 +28,4 @@ body {
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
text-align: start;
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/wwwroot/css/site.css b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/wwwroot/css/site.css
index 3ae451900f3c..786ccace5be9 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/wwwroot/css/site.css
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/wwwroot/css/site.css
@@ -71,4 +71,4 @@ body {
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
text-align: start;
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/.template.config/template.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/.template.config/template.json
index 26f2ea88e496..a4b53862f6ea 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/.template.config/template.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/.template.config/template.json
@@ -162,4 +162,4 @@
"continueOnError": true
}
]
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/Worker-FSharp/Program.fs b/src/ProjectTemplates/Web.ProjectTemplates/content/Worker-FSharp/Program.fs
index aa488b71f2c4..71622b50edc9 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/Worker-FSharp/Program.fs
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/Worker-FSharp/Program.fs
@@ -16,4 +16,4 @@ module Program =
builder.Build().Run()
- 0 // exit code
\ No newline at end of file
+ 0 // exit code
diff --git a/src/ProjectTemplates/test/Templates.Tests/NewlineEndingTest.cs b/src/ProjectTemplates/test/Templates.Tests/NewlineEndingTest.cs
new file mode 100644
index 000000000000..ab4f91d33f47
--- /dev/null
+++ b/src/ProjectTemplates/test/Templates.Tests/NewlineEndingTest.cs
@@ -0,0 +1,95 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Microsoft.AspNetCore.InternalTesting;
+using Templates.Test.Helpers;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace Templates.Test;
+
+public class NewlineEndingTest : LoggedTest
+{
+ private ITestOutputHelper _output;
+ public ITestOutputHelper Output
+ {
+ get
+ {
+ if (_output == null)
+ {
+ _output = new TestOutputLogger(Logger);
+ }
+ return _output;
+ }
+ }
+
+ public NewlineEndingTest()
+ {
+ }
+
+ [Theory]
+ [InlineData("Web.ProjectTemplates")]
+ [InlineData("Web.ItemTemplates")]
+ [InlineData("Web.Client.ItemTemplates")]
+ public void TemplateFiles_ShouldEndWithNewline(string projectName)
+ {
+ var templateDirectoryPath = GetTemplateDirectoryPath(projectName);
+
+ var filesWithoutNewlineEnding = new List();
+
+ // Get all template source files (excluding third-party libraries and localization files)
+ var files = Directory.GetFiles(templateDirectoryPath, "*.cs", SearchOption.AllDirectories)
+ .Concat(Directory.GetFiles(templateDirectoryPath, "*.fs", SearchOption.AllDirectories))
+ .Concat(Directory.GetFiles(templateDirectoryPath, "*.razor", SearchOption.AllDirectories))
+ .Concat(Directory.GetFiles(templateDirectoryPath, "*.cshtml", SearchOption.AllDirectories))
+ .Concat(Directory.GetFiles(templateDirectoryPath, "*.css", SearchOption.AllDirectories))
+ .Concat(Directory.GetFiles(templateDirectoryPath, "*.js", SearchOption.AllDirectories))
+ .Concat(Directory.GetFiles(templateDirectoryPath, "*.ts", SearchOption.AllDirectories))
+ .Concat(Directory.GetFiles(templateDirectoryPath, "*.tsx", SearchOption.AllDirectories))
+ .Concat(Directory.GetFiles(templateDirectoryPath, "*.html", SearchOption.AllDirectories))
+ .Concat(Directory.GetFiles(templateDirectoryPath, "*.json", SearchOption.AllDirectories))
+ .Concat(Directory.GetFiles(templateDirectoryPath, "*.xml", SearchOption.AllDirectories))
+ .Concat(Directory.GetFiles(templateDirectoryPath, "*.csproj", SearchOption.AllDirectories))
+ .Concat(Directory.GetFiles(templateDirectoryPath, "*.fsproj", SearchOption.AllDirectories))
+ .Where(f => !f.Contains($"{Path.DirectorySeparatorChar}wwwroot{Path.DirectorySeparatorChar}lib{Path.DirectorySeparatorChar}")) // Exclude third-party libraries
+ .Where(f => !f.Contains($"{Path.DirectorySeparatorChar}.template.config{Path.DirectorySeparatorChar}localize{Path.DirectorySeparatorChar}")); // Exclude localization files
+
+ foreach (var file in files)
+ {
+ var filePath = Path.GetFullPath(file);
+ var fileInfo = new FileInfo(filePath);
+
+ // Skip empty files
+ if (fileInfo.Length == 0)
+ {
+ continue;
+ }
+
+ // Check if file ends with newline (0x0a)
+ using var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
+ fileStream.Seek(-1, SeekOrigin.End);
+ var lastByte = fileStream.ReadByte();
+
+ if (lastByte != 0x0a) // LF
+ {
+ Output.WriteLine($"File {filePath} does not end with a newline.");
+ filesWithoutNewlineEnding.Add(filePath);
+ }
+ }
+
+ Assert.False(filesWithoutNewlineEnding.Any(), $"Found {filesWithoutNewlineEnding.Count} file(s) without newline ending.");
+ }
+
+ private string GetTemplateDirectoryPath(string projectName)
+ {
+ var currentDirectory = Directory.GetCurrentDirectory();
+ var AssetsDir = Path.Combine(currentDirectory, "Assets");
+ var path = Path.Combine(projectName, "content");
+ var templateDirectoryPath = Path.Combine(AssetsDir, path);
+
+ return templateDirectoryPath;
+ }
+}
From 75b962eca97d1eb09dd00673f375c968393abf20 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 18 Dec 2025 13:20:45 +0000
Subject: [PATCH 3/4] Fix additional template config files to end with newline
Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
---
.../content/WebApi-CSharp/.template.config/cs/strings.json | 2 +-
.../content/WebApi-CSharp/.template.config/de/strings.json | 2 +-
.../WebApi-CSharp/.template.config/dotnetcli.host.json | 2 +-
.../content/WebApi-CSharp/.template.config/es/strings.json | 2 +-
.../content/WebApi-CSharp/.template.config/fr/strings.json | 2 +-
.../content/WebApi-CSharp/.template.config/it/strings.json | 2 +-
.../content/WebApi-CSharp/.template.config/ja/strings.json | 2 +-
.../content/WebApi-CSharp/.template.config/ko/strings.json | 2 +-
.../content/WebApi-CSharp/.template.config/pl/strings.json | 2 +-
.../content/WebApi-CSharp/.template.config/pt-BR/strings.json | 2 +-
.../content/WebApi-CSharp/.template.config/ru/strings.json | 2 +-
.../content/WebApi-CSharp/.template.config/tr/strings.json | 2 +-
.../WebApi-CSharp/.template.config/zh-Hans/strings.json | 2 +-
.../WebApi-CSharp/.template.config/zh-Hant/strings.json | 2 +-
.../WebApiAot-CSharp/.template.config/dotnetcli.host.json | 2 +-
.../content/WebApiAot-CSharp/.template.config/ide.host.json | 2 +-
.../test/Templates.Tests/NewlineEndingTest.cs | 4 ++--
17 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/cs/strings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/cs/strings.json
index 5ef3acce5dbc..3afaf46a094d 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/cs/strings.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/cs/strings.json
@@ -8,4 +8,4 @@
"parameter.UseMinimalAPIs.name": "Použití ovladačů",
"parameter.UseMinimalAPIs.description": "Místo minimálních rozhraní API používejte kontrolery."
}
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/de/strings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/de/strings.json
index 9e0c5f064a60..32b3b41a95d0 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/de/strings.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/de/strings.json
@@ -8,4 +8,4 @@
"parameter.UseMinimalAPIs.name": "Controller verwenden",
"parameter.UseMinimalAPIs.description": "Verwenden Sie Controller anstelle minimaler APIs."
}
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/dotnetcli.host.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/dotnetcli.host.json
index ff259de599b8..a1b4134c2c96 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/dotnetcli.host.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/dotnetcli.host.json
@@ -99,4 +99,4 @@
"usageExamples": [
""
]
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/es/strings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/es/strings.json
index efba45376922..15d70d02a2fd 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/es/strings.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/es/strings.json
@@ -8,4 +8,4 @@
"parameter.UseMinimalAPIs.name": "Utilizar controladores",
"parameter.UseMinimalAPIs.description": "Utilice controladores en lugar de API mínimas."
}
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/fr/strings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/fr/strings.json
index a5b26a612266..b835be6ccacc 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/fr/strings.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/fr/strings.json
@@ -8,4 +8,4 @@
"parameter.UseMinimalAPIs.name": "Utiliser des contrôleurs",
"parameter.UseMinimalAPIs.description": "Utilisez des contrôleurs à la place des API minimales."
}
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/it/strings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/it/strings.json
index fded2cb43274..945ab03c5d0e 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/it/strings.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/it/strings.json
@@ -8,4 +8,4 @@
"parameter.UseMinimalAPIs.name": "Usa i controller",
"parameter.UseMinimalAPIs.description": "Usa i controller anziché le API minime."
}
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/ja/strings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/ja/strings.json
index c3b3f2fdbe1e..5bd793acc579 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/ja/strings.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/ja/strings.json
@@ -8,4 +8,4 @@
"parameter.UseMinimalAPIs.name": "コントローラーを使用する",
"parameter.UseMinimalAPIs.description": "最小限の API ではなくコントローラーを使用します。"
}
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/ko/strings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/ko/strings.json
index 332cfe0844f7..092decfe43f6 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/ko/strings.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/ko/strings.json
@@ -8,4 +8,4 @@
"parameter.UseMinimalAPIs.name": "컨트롤러 사용",
"parameter.UseMinimalAPIs.description": "최소 API 대신 컨트롤러를 사용합니다."
}
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/pl/strings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/pl/strings.json
index 016f03a4789e..2448c39bf579 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/pl/strings.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/pl/strings.json
@@ -8,4 +8,4 @@
"parameter.UseMinimalAPIs.name": "Użyj kontrolerów",
"parameter.UseMinimalAPIs.description": "Użyj kontrolerów zamiast minimalnych interfejsów API."
}
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/pt-BR/strings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/pt-BR/strings.json
index b071c22ebeb7..d4eea750f601 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/pt-BR/strings.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/pt-BR/strings.json
@@ -8,4 +8,4 @@
"parameter.UseMinimalAPIs.name": "Usar controles",
"parameter.UseMinimalAPIs.description": "Use controles em vez de APIs mínimas."
}
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/ru/strings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/ru/strings.json
index 31b0bade52fe..a61661394804 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/ru/strings.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/ru/strings.json
@@ -8,4 +8,4 @@
"parameter.UseMinimalAPIs.name": "Использовать контроллеры",
"parameter.UseMinimalAPIs.description": "Используйте контроллеры вместо минимальных API."
}
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/tr/strings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/tr/strings.json
index 5c1d97a80f9e..95f5484dbca5 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/tr/strings.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/tr/strings.json
@@ -8,4 +8,4 @@
"parameter.UseMinimalAPIs.name": "Denetleyicileri kullan",
"parameter.UseMinimalAPIs.description": "Minimal API yerine denetleyicileri kullanın."
}
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/zh-Hans/strings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/zh-Hans/strings.json
index 7a55ec801dd2..9143c437c46c 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/zh-Hans/strings.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/zh-Hans/strings.json
@@ -8,4 +8,4 @@
"parameter.UseMinimalAPIs.name": "使用控制器",
"parameter.UseMinimalAPIs.description": "使用控制器而不是最小 API。"
}
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/zh-Hant/strings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/zh-Hant/strings.json
index f45a6ddf64e3..8f0fa7b2e839 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/zh-Hant/strings.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/zh-Hant/strings.json
@@ -8,4 +8,4 @@
"parameter.UseMinimalAPIs.name": "使用控制器",
"parameter.UseMinimalAPIs.description": "使用控制器,而不使用最小 API。"
}
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/.template.config/dotnetcli.host.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/.template.config/dotnetcli.host.json
index d24ccc689f1c..cf66683674a7 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/.template.config/dotnetcli.host.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/.template.config/dotnetcli.host.json
@@ -30,4 +30,4 @@
"usageExamples": [
""
]
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/.template.config/ide.host.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/.template.config/ide.host.json
index de0bfb10ae91..d5e928040b0d 100644
--- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/.template.config/ide.host.json
+++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/.template.config/ide.host.json
@@ -26,4 +26,4 @@
"persistenceScope": "templateGroup"
}
]
-}
\ No newline at end of file
+}
diff --git a/src/ProjectTemplates/test/Templates.Tests/NewlineEndingTest.cs b/src/ProjectTemplates/test/Templates.Tests/NewlineEndingTest.cs
index ab4f91d33f47..f0cb107d9623 100644
--- a/src/ProjectTemplates/test/Templates.Tests/NewlineEndingTest.cs
+++ b/src/ProjectTemplates/test/Templates.Tests/NewlineEndingTest.cs
@@ -40,7 +40,7 @@ public void TemplateFiles_ShouldEndWithNewline(string projectName)
var filesWithoutNewlineEnding = new List();
- // Get all template source files (excluding third-party libraries and localization files)
+ // Get all template source files (excluding third-party libraries and auto-generated localization files)
var files = Directory.GetFiles(templateDirectoryPath, "*.cs", SearchOption.AllDirectories)
.Concat(Directory.GetFiles(templateDirectoryPath, "*.fs", SearchOption.AllDirectories))
.Concat(Directory.GetFiles(templateDirectoryPath, "*.razor", SearchOption.AllDirectories))
@@ -55,7 +55,7 @@ public void TemplateFiles_ShouldEndWithNewline(string projectName)
.Concat(Directory.GetFiles(templateDirectoryPath, "*.csproj", SearchOption.AllDirectories))
.Concat(Directory.GetFiles(templateDirectoryPath, "*.fsproj", SearchOption.AllDirectories))
.Where(f => !f.Contains($"{Path.DirectorySeparatorChar}wwwroot{Path.DirectorySeparatorChar}lib{Path.DirectorySeparatorChar}")) // Exclude third-party libraries
- .Where(f => !f.Contains($"{Path.DirectorySeparatorChar}.template.config{Path.DirectorySeparatorChar}localize{Path.DirectorySeparatorChar}")); // Exclude localization files
+ .Where(f => !f.Contains($"{Path.DirectorySeparatorChar}.template.config{Path.DirectorySeparatorChar}localize{Path.DirectorySeparatorChar}")); // Exclude auto-generated localization files in localize directory
foreach (var file in files)
{
From b65a943eb3a5f1ce914d3aca9e84e261bafc64f4 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 18 Dec 2025 13:24:17 +0000
Subject: [PATCH 4/4] Address code review feedback for NewlineEndingTest
Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
---
.../test/Templates.Tests/NewlineEndingTest.cs | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/ProjectTemplates/test/Templates.Tests/NewlineEndingTest.cs b/src/ProjectTemplates/test/Templates.Tests/NewlineEndingTest.cs
index f0cb107d9623..313b77b0f67d 100644
--- a/src/ProjectTemplates/test/Templates.Tests/NewlineEndingTest.cs
+++ b/src/ProjectTemplates/test/Templates.Tests/NewlineEndingTest.cs
@@ -26,10 +26,6 @@ public ITestOutputHelper Output
}
}
- public NewlineEndingTest()
- {
- }
-
[Theory]
[InlineData("Web.ProjectTemplates")]
[InlineData("Web.ItemTemplates")]
@@ -60,9 +56,9 @@ public void TemplateFiles_ShouldEndWithNewline(string projectName)
foreach (var file in files)
{
var filePath = Path.GetFullPath(file);
- var fileInfo = new FileInfo(filePath);
- // Skip empty files
+ // Skip empty files before opening the stream
+ var fileInfo = new FileInfo(filePath);
if (fileInfo.Length == 0)
{
continue;