Skip to content

Commit aa1aabb

Browse files
committed
Added common high-use usings as global usings. Removed unused usings in TemplateEngine projects as they cause build errors based on their project settings. Adjusted one class name conflict.
1 parent d8f22a5 commit aa1aabb

25 files changed

+10
-27
lines changed

Directory.Build.props

+8
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,13 @@
4747
<ImplicitUsings>enable</ImplicitUsings>
4848
</PropertyGroup>
4949

50+
<!-- Global usings -->
51+
<!-- See: https://learn.microsoft.com/dotnet/core/project-sdk/msbuild-props#using -->
52+
<ItemGroup>
53+
<Using Include="System.Runtime.InteropServices" />
54+
<Using Include="System.Text" />
55+
<Using Include="System.Xml.Linq" />
56+
</ItemGroup>
57+
5058
<Import Project="build/GenerateResxSource.targets" />
5159
</Project>

src/Cli/Microsoft.TemplateEngine.Cli/CliTemplateParameter.cs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.CommandLine.Parsing;
77
using System.Diagnostics;
88
using System.Globalization;
9-
using System.Text;
109
using Microsoft.TemplateEngine.Abstractions;
1110
using Microsoft.TemplateEngine.Cli.Commands;
1211

src/Cli/Microsoft.TemplateEngine.Cli/Commands/CliPathInfo.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Runtime.InteropServices;
54
using Microsoft.DotNet.Cli.Utils;
65
using Microsoft.DotNet.Configurer;
76
using Microsoft.TemplateEngine.Abstractions;

src/Cli/Microsoft.TemplateEngine.Cli/Commands/CommandLineUtils.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.CommandLine;
5-
using System.Text;
65

76
namespace Microsoft.TemplateEngine.Cli.Commands
87
{

src/Cli/Microsoft.TemplateEngine.Cli/Commands/InvalidTemplateParametersException.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Text;
5-
64
namespace Microsoft.TemplateEngine.Cli.Commands
75
{
86
internal class InvalidTemplateParametersException : Exception

src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.NoMatchHandling.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.CommandLine;
5-
using System.Text;
65
using Microsoft.DotNet.Cli.Utils;
76
using Microsoft.TemplateEngine.Abstractions;
87
using Microsoft.TemplateEngine.Edge.Settings;

src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InvalidTemplateOptionResult.cs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.CommandLine;
55
using System.CommandLine.Parsing;
6-
using System.Text;
76
using Microsoft.TemplateEngine.Abstractions;
87

98
namespace Microsoft.TemplateEngine.Cli.Commands

src/Cli/Microsoft.TemplateEngine.Cli/Extensions.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Text;
54
using Microsoft.TemplateEngine.Abstractions;
65
using Microsoft.TemplateEngine.Abstractions.Constraints;
76
using Microsoft.TemplateEngine.Utils;

src/Cli/Microsoft.TemplateEngine.Cli/IReporterExtensions.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Diagnostics;
5-
using System.Text;
65
using Microsoft.DotNet.Cli.Utils;
76

87
namespace Microsoft.TemplateEngine.Cli

src/Cli/Microsoft.TemplateEngine.Cli/TabularOutput/TabularOutput.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Text;
5-
64
namespace Microsoft.TemplateEngine.Cli.TabularOutput
75
{
86
internal class TabularOutput

src/Cli/Microsoft.TemplateEngine.Cli/TemplateListCoordinator.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Text;
54
using Microsoft.DotNet.Cli.Utils;
65
using Microsoft.TemplateEngine.Abstractions;
76
using Microsoft.TemplateEngine.Cli.Commands;

src/Cli/Microsoft.TemplateEngine.Cli/TemplateSearch/CliTemplateSearchCoordinator.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Text;
54
using Microsoft.DotNet.Cli.Utils;
65
using Microsoft.TemplateEngine.Abstractions;
76
using Microsoft.TemplateEngine.Abstractions.TemplatePackage;

src/Cli/dotnet-new3/ArgumentEscaper.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Text;
5-
64
namespace Dotnet_new3
75
{
86
internal static class ArgumentEscaper

src/Cli/dotnet-new3/Dotnet.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Diagnostics;
5-
using System.Text;
65

76
namespace Dotnet_new3
87
{

src/Cli/dotnet-new3/Program.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.CommandLine;
5-
using System.Text;
65

76
namespace Dotnet_new3
87
{

src/Cli/dotnet/Telemetry/Telemetry.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.ApplicationInsights.Extensibility;
1010
using Microsoft.DotNet.Cli.Utils;
1111
using Microsoft.DotNet.Configurer;
12+
using CLIRuntimeEnvironment = Microsoft.DotNet.Cli.Utils.RuntimeEnvironment;
1213

1314
namespace Microsoft.DotNet.Cli.Telemetry
1415
{
@@ -146,7 +147,7 @@ private void InitializeTelemetry()
146147
config.ConnectionString = ConnectionString;
147148
_client = new TelemetryClient(config);
148149
_client.Context.Session.Id = CurrentSessionId;
149-
_client.Context.Device.OperatingSystem = RuntimeEnvironment.OperatingSystem;
150+
_client.Context.Device.OperatingSystem = CLIRuntimeEnvironment.OperatingSystem;
150151

151152
_commonProperties = new TelemetryCommonProperties().GetTelemetryCommonProperties();
152153
_commonMeasurements = new Dictionary<string, double>();

src/Tests/Microsoft.TemplateEngine.Cli.UnitTests/TemplatePackageDisplayTest.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.CommandLine;
5-
using System.Text;
65
using FakeItEasy;
76
using Microsoft.DotNet.Cli.Utils;
87
using Microsoft.TemplateEngine.Abstractions;

src/Tests/dotnet-new.Tests/CommonTemplatesTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Diagnostics;
5-
using System.Runtime.InteropServices;
65
using System.Text.RegularExpressions;
76
using Microsoft.DotNet.Cli.Utils;
87
using Microsoft.DotNet.Tools.New;

src/Tests/dotnet-new.Tests/DotnetClassTemplateTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Text;
54
using Microsoft.Extensions.Logging;
65
using Microsoft.TemplateEngine.Authoring.TemplateVerifier;
76
using NuGet.Packaging;

src/Tests/dotnet-new.Tests/DotnetNewDebugOptionsTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Runtime.InteropServices;
54
using Microsoft.DotNet.Cli.Utils;
65

76
namespace Microsoft.DotNet.Cli.New.IntegrationTests

src/Tests/dotnet-new.Tests/DotnetNewLocaleTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Globalization;
5-
using System.Text;
65
using System.Text.RegularExpressions;
76
using Microsoft.DotNet.Cli.Utils;
87
using Microsoft.TemplateEngine.TestHelper;

src/Tests/dotnet-new.Tests/DotnetNewSearchTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Text;
54
using Microsoft.DotNet.Cli.Utils;
65

76
namespace Microsoft.DotNet.Cli.New.IntegrationTests

src/Tests/dotnet-new.Tests/PostActionTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Runtime.InteropServices;
54
using System.Text.Json.Nodes;
65
using Microsoft.DotNet.Cli.Utils;
76
using Microsoft.TemplateEngine.Utils;

src/Tests/dotnet-new.Tests/TemplateEngineSamplesTest.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Text;
54
using EmptyFiles;
65
using Microsoft.Extensions.Logging;
76
using Microsoft.TemplateEngine.Authoring.TemplateVerifier;

src/Tests/dotnet-new.Tests/VerifyScrubbers.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Text;
54
using System.Text.RegularExpressions;
65

76
namespace Microsoft.DotNet.Cli.New.IntegrationTests

0 commit comments

Comments
 (0)