Skip to content

Commit 60b9a1b

Browse files
jjonesczgithub-actions
authored andcommitted
Unify writing code style
1 parent 06cd32d commit 60b9a1b

File tree

1 file changed

+34
-18
lines changed

1 file changed

+34
-18
lines changed

src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,9 @@ public static void WriteProjectFile(
712712

713713
// Write default and custom properties.
714714
{
715-
writer.WriteLine(" <PropertyGroup>");
715+
writer.WriteLine("""
716+
<PropertyGroup>
717+
""");
716718

717719
// First write the default properties except those specified by the user.
718720
var customPropertyNames = propertyDirectives.Select(d => d.Name).ToHashSet(StringComparer.OrdinalIgnoreCase);
@@ -752,13 +754,17 @@ public static void WriteProjectFile(
752754
""");
753755
}
754756

755-
writer.WriteLine(" </PropertyGroup>");
756-
writer.WriteLine();
757+
writer.WriteLine("""
758+
</PropertyGroup>
759+
760+
""");
757761
}
758762

759763
if (packageDirectives.Any())
760764
{
761-
writer.WriteLine(" <ItemGroup>");
765+
writer.WriteLine("""
766+
<ItemGroup>
767+
""");
762768

763769
foreach (var package in packageDirectives)
764770
{
@@ -778,13 +784,17 @@ public static void WriteProjectFile(
778784
processedDirectives++;
779785
}
780786

781-
writer.WriteLine(" </ItemGroup>");
782-
writer.WriteLine();
787+
writer.WriteLine("""
788+
</ItemGroup>
789+
790+
""");
783791
}
784792

785793
if (projectDirectives.Any())
786794
{
787-
writer.WriteLine(" <ItemGroup>");
795+
writer.WriteLine("""
796+
<ItemGroup>
797+
""");
788798

789799
foreach (var projectReference in projectDirectives)
790800
{
@@ -795,8 +805,10 @@ public static void WriteProjectFile(
795805
processedDirectives++;
796806
}
797807

798-
writer.WriteLine(" </ItemGroup>");
799-
writer.WriteLine();
808+
writer.WriteLine("""
809+
</ItemGroup>
810+
811+
""");
800812
}
801813

802814
Debug.Assert(processedDirectives + directives.OfType<CSharpDirective.Shebang>().Count() == directives.Length);
@@ -816,12 +828,12 @@ public static void WriteProjectFile(
816828
{
817829
var targetDirectory = Path.GetDirectoryName(targetFilePath) ?? "";
818830
writer.WriteLine($"""
819-
<ItemGroup>
820-
<RuntimeHostConfigurationOption Include="EntryPointFilePath" Value="{EscapeValue(targetFilePath)}" />
821-
<RuntimeHostConfigurationOption Include="EntryPointFileDirectoryPath" Value="{EscapeValue(targetDirectory)}" />
822-
</ItemGroup>
831+
<ItemGroup>
832+
<RuntimeHostConfigurationOption Include="EntryPointFilePath" Value="{EscapeValue(targetFilePath)}" />
833+
<RuntimeHostConfigurationOption Include="EntryPointFileDirectoryPath" Value="{EscapeValue(targetDirectory)}" />
834+
</ItemGroup>
823835
824-
""");
836+
""");
825837
}
826838

827839
foreach (var sdk in sdkDirectives)
@@ -837,12 +849,16 @@ public static void WriteProjectFile(
837849
""");
838850
}
839851

840-
writer.WriteLine();
841-
writer.WriteLine(TargetOverrides);
842-
writer.WriteLine();
852+
writer.WriteLine($"""
853+
854+
{TargetOverrides}
855+
856+
""");
843857
}
844858

845-
writer.WriteLine("</Project>");
859+
writer.WriteLine("""
860+
</Project>
861+
""");
846862

847863
static string EscapeValue(string value) => SecurityElement.Escape(value);
848864

0 commit comments

Comments
 (0)