Skip to content

Commit 7c059fc

Browse files
Fix warning NU1903 in consumer projects' dependencies
1 parent e762749 commit 7c059fc

File tree

15 files changed

+94
-155
lines changed

15 files changed

+94
-155
lines changed

CSharpInteractive.HostApi/CSharpInteractive.HostApi.csproj

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<RootNamespace>HostApi</RootNamespace>
99
<ImmutypeAPI>True</ImmutypeAPI>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>
11+
<Title>Build automation library abstractions for .NET</Title>
12+
<Description>$(Title)</Description>
1113
</PropertyGroup>
1214

1315
<ItemGroup>
@@ -16,30 +18,13 @@
1618
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1719
</PackageReference>
1820
<PackageReference Include="TeamCity.ServiceMessages" Version="4.1.1"/>
21+
<PackageReference Include="NuGet.Versioning" Version="6.14.0"/>
1922
<InternalsVisibleTo Include="DynamicProxyGenAssembly2"/>
2023
<InternalsVisibleTo Include="dotnet-csi"/>
2124
<InternalsVisibleTo Include="CSharpInteractive"/>
2225
<InternalsVisibleTo Include="CSharpInteractive.Tests"/>
2326
</ItemGroup>
2427

25-
<Choose>
26-
<When Condition="'$(TargetFramework)'=='net8.0'">
27-
<ItemGroup>
28-
<PackageReference Include="NuGet.Versioning" Version="6.11.1"/>
29-
</ItemGroup>
30-
</When>
31-
<When Condition="'$(TargetFramework)'=='net9.0'">
32-
<ItemGroup>
33-
<PackageReference Include="NuGet.Versioning" Version="6.12.1"/>
34-
</ItemGroup>
35-
</When>
36-
<Otherwise>
37-
<ItemGroup>
38-
<PackageReference Include="NuGet.Versioning" Version="6.12.1"/>
39-
</ItemGroup>
40-
</Otherwise>
41-
</Choose>
42-
4328
<ItemGroup>
4429
<None Update="CommandLines.tt">
4530
<LastGenOutput>CommandLines.cs</LastGenOutput>

CSharpInteractive.HostApi/CommandLines.cs

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -5441,71 +5441,3 @@ public partial record DockerRun: ICommandLine
54415441
public static DockerRun operator -(DockerRun command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars);
54425442
}
54435443

5444-
[ExcludeFromCodeCoverage]
5445-
public partial record UnityPlayer: ICommandLine
5446-
{
5447-
/// <summary>
5448-
/// Appends an argument.
5449-
/// </summary>
5450-
/// <param name="command">The command to which an argument will be added.</param>
5451-
/// <param name="arg">Argument to add.</param>
5452-
/// <returns>Returns a new command with the corresponding changes.</returns>
5453-
public static UnityPlayer operator +(UnityPlayer command, string arg) => command.AddArgs(arg);
5454-
5455-
/// <summary>
5456-
/// Removes an argument by its name.
5457-
/// </summary>
5458-
/// <param name="command">The command to which an argument will be removed.</param>
5459-
/// <param name="arg">Argument to remove.</param>
5460-
/// <returns>Returns a new command with the corresponding changes.</returns>
5461-
public static UnityPlayer operator -(UnityPlayer command, string arg) => command.RemoveArgs(arg);
5462-
5463-
/// <summary>
5464-
/// Appends arguments.
5465-
/// </summary>
5466-
/// <param name="command">The command to which arguments will be added.</param>
5467-
/// <param name="args">Arguments to add.</param>
5468-
/// <returns>Returns a new command with the corresponding changes.</returns>
5469-
public static UnityPlayer operator +(UnityPlayer command, IEnumerable<string> args) => command.AddArgs(args);
5470-
5471-
/// <summary>
5472-
/// Removes arguments by their name.
5473-
/// </summary>
5474-
/// <param name="command">The command to which arguments will be removed.</param>
5475-
/// <param name="args">Arguments to remove.</param>
5476-
/// <returns>Returns a new command with the corresponding changes.</returns>
5477-
public static UnityPlayer operator -(UnityPlayer command, IEnumerable<string> args) => command.RemoveArgs(args);
5478-
5479-
/// <summary>
5480-
/// Appends an environment variable.
5481-
/// </summary>
5482-
/// <param name="command">The command to which an environment variable will be added.</param>
5483-
/// <param name="var">Environment variable to add.</param>
5484-
/// <returns>Returns a new command with the corresponding changes.</returns>
5485-
public static UnityPlayer operator +(UnityPlayer command, (string name, string value) var) => command.AddVars(var);
5486-
5487-
/// <summary>
5488-
/// Removes environment variable by its name and value.
5489-
/// </summary>
5490-
/// <param name="command">The command to which an environment variable will be removed.</param>
5491-
/// <param name="var">Environment variable to remove.</param>
5492-
/// <returns>Returns a new command with the corresponding changes.</returns>
5493-
public static UnityPlayer operator -(UnityPlayer command, (string name, string value) var) => command.RemoveVars(var);
5494-
5495-
/// <summary>
5496-
/// Appends environment variables.
5497-
/// </summary>
5498-
/// <param name="command">The command to which environment variables will be added.</param>
5499-
/// <param name="vars">Environment variables to add.</param>
5500-
/// <returns>Returns a new command with the corresponding changes.</returns>
5501-
public static UnityPlayer operator +(UnityPlayer command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars);
5502-
5503-
/// <summary>
5504-
/// Removes environment variables by their name and value.
5505-
/// </summary>
5506-
/// <param name="command">The command to which environment variables will be removed.</param>
5507-
/// <param name="vars">environment variables to remove.</param>
5508-
/// <returns>Returns a new command with the corresponding changes.</returns>
5509-
public static UnityPlayer operator -(UnityPlayer command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars);
5510-
}
5511-

CSharpInteractive.HostApi/CommandLines.tt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,7 @@ namespace HostApi;
8787

8888
// Docker
8989
"DockerCustom",
90-
"DockerRun",
91-
92-
// Unity
93-
"UnityPlayer"
90+
"DockerRun"
9491
};
9592
#>
9693
<#

CSharpInteractive.HostApi/Text.cs

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,24 @@
1111
[Target]
1212
public readonly record struct Text(string Value = "", Color Color = Color.Default)
1313
{
14-
// ReSharper disable once UnusedMember.Global
14+
/// <summary>
15+
/// Represents an empty text.
16+
/// </summary>
1517
public static readonly Text Empty = new(string.Empty);
18+
19+
/// <summary>
20+
/// Represents a new line.
21+
/// </summary>
1622
public static readonly Text NewLine = new(Environment.NewLine);
23+
24+
/// <summary>
25+
/// Represents a space.
26+
/// </summary>
1727
public static readonly Text Space = new(" ");
28+
29+
/// <summary>
30+
/// Represents a tab.
31+
/// </summary>
1832
public static readonly Text Tab = new(" ");
1933

2034
/// <summary>
@@ -26,10 +40,21 @@ public Text(string value)
2640
: this(value, Color.Default)
2741
{ }
2842

43+
/// <summary>
44+
/// Implicitly converts a single <see cref="Text"/> instance to an array containing that instance.
45+
/// </summary>
46+
/// <param name="text">The text to convert.</param>
47+
/// <returns>An array containing the single text instance.</returns>
2948
public static implicit operator Text[](Text text) => [text];
3049

50+
/// <summary>
51+
/// Implicitly converts a string to a <see cref="Text"/> instance with default color.
52+
/// </summary>
53+
/// <param name="text">The string to convert.</param>
54+
/// <returns>A Text instance with the specified string value and default color.</returns>
3155
public static implicit operator Text (string text) => new(text);
3256

57+
/// <inheritdoc/>
3358
public override string ToString()
3459
{
3560
var sb = new StringBuilder();
@@ -45,6 +70,12 @@ public override string ToString()
4570
return sb.ToString();
4671
}
4772

73+
/// <summary>
74+
/// Combines two <see cref="Text"/> instances into an array.
75+
/// </summary>
76+
/// <param name="text1">The first text instance.</param>
77+
/// <param name="text2">The second text instance.</param>
78+
/// <returns>An array containing both text instances.</returns>
4879
public static Text[] operator +(Text text1, Text text2)
4980
{
5081
var newText = new Text[2];
@@ -53,6 +84,12 @@ public override string ToString()
5384
return newText;
5485
}
5586

87+
/// <summary>
88+
/// Appends a <see cref="Text"/> instance to an array of text instances.
89+
/// </summary>
90+
/// <param name="text">The array of text instances.</param>
91+
/// <param name="text2">The text instance to append.</param>
92+
/// <returns>A new array containing all original text instances with the new text appended at the end.</returns>
5693
public static Text[] operator +(Text[] text, Text text2)
5794
{
5895
var newText = new Text[text.Length + 1];
@@ -61,6 +98,12 @@ public override string ToString()
6198
return newText;
6299
}
63100

101+
/// <summary>
102+
/// Prepends a <see cref="Text"/> instance to an array of text instances.
103+
/// </summary>
104+
/// <param name="text1">The text instance to prepend.</param>
105+
/// <param name="text">The array of text instances.</param>
106+
/// <returns>A new array containing the prepended text followed by all original text instances.</returns>
64107
public static Text[] operator +(Text text1, Text[] text)
65108
{
66109
var newText = new Text[text.Length + 1];
@@ -69,7 +112,9 @@ public override string ToString()
69112
return newText;
70113
}
71114

115+
/// <inheritdoc/>
72116
public bool Equals(Text other) => Value == other.Value && Color == other.Color;
73117

118+
/// <inheritdoc/>
74119
public override int GetHashCode() => Value.GetHashCode() ^ 33 + (int)Color;
75120
}

CSharpInteractive.HostApi/UnityPlayer.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

CSharpInteractive.Templates/CSharpInteractive.Templates.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<EnableDefaultItems>False</EnableDefaultItems>
1212
<NoPackageAnalysis>true</NoPackageAnalysis>
1313
<PackageId>CSharpInteractive.Templates</PackageId>
14-
<Title>C# script Templates</Title>
15-
<Description>$(Company) $(Title) $(Version) $(TargetFramework)</Description>
14+
<Title>Build automation project templates for .NET</Title>
15+
<Description>$(Title)</Description>
1616
<PackageType>Template</PackageType>
1717
<PackageReadmeFile>content/ConsoleApplication-CSharp/README.md</PackageReadmeFile>
1818
<SuppressDependenciesWhenPacking>True</SuppressDependenciesWhenPacking>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
dotnet pack -c Release CSharpInteractive.Templates.csproj -p:version=1.1.0
1+
dotnet pack -c Release CSharpInteractive.Templates.csproj -p:version=2.1.0
22
dotnet new uninstall CSharpInteractive.Templates
3-
dotnet new install CSharpInteractive.Templates::1.1.0 --nuget-source %cd%/bin
3+
dotnet new install CSharpInteractive.Templates::1.2.0 --nuget-source %cd%/bin

CSharpInteractive.Tests/README_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ new DotNetNew()
489489
.WithTemplateName("sln")
490490
.WithName("MySolution")
491491
.WithForce(true)
492+
.AddArgs("--format", "sln")
492493
.Run().EnsureSuccess();
493494

494495
new DotNetSlnAdd()

CSharpInteractive.Tests/UsageScenarios/Comments/DotNetSlnAddScenario.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ new DotNetNew()
44
.WithTemplateName("sln")
55
.WithName("MySolution")
66
.WithForce(true)
7+
.AddArgs("--format", "sln")
78
.Run().EnsureSuccess();
89

910
new DotNetSlnAdd()

CSharpInteractive.Tests/UsageScenarios/DotNetSlnAddScenario.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public void Run()
3838
.AddArgs("--format", "sln")
3939
.Run().EnsureSuccess();
4040

41-
new CommandLine("dir").Run();
42-
4341
new DotNetSlnAdd()
4442
.WithSolution("MySolution.sln")
4543
.AddProjects(

0 commit comments

Comments
 (0)