Skip to content

Commit a6031d0

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

File tree

8 files changed

+69
-133
lines changed

8 files changed

+69
-133
lines changed

CSharpInteractive.HostApi/CSharpInteractive.HostApi.csproj

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,13 @@
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
</PackageReference>
1818
<PackageReference Include="TeamCity.ServiceMessages" Version="4.1.1"/>
19+
<PackageReference Include="NuGet.Versioning" Version="6.14.0"/>
1920
<InternalsVisibleTo Include="DynamicProxyGenAssembly2"/>
2021
<InternalsVisibleTo Include="dotnet-csi"/>
2122
<InternalsVisibleTo Include="CSharpInteractive"/>
2223
<InternalsVisibleTo Include="CSharpInteractive.Tests"/>
2324
</ItemGroup>
2425

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-
4326
<ItemGroup>
4427
<None Update="CommandLines.tt">
4528
<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/CSharpInteractive.Tool.csproj

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<ItemGroup>
3232
<!--<CompilerVisibleProperty Include="PureDIProfilePath" />-->
33-
<PackageReference Include="Microsoft.CodeAnalysis.Scripting" Version="5.0.0-2.final" />
33+
<PackageReference Include="Microsoft.CodeAnalysis.Scripting" Version="5.0.0" />
3434
<PackageReference Include="Pure.DI" Version="2.2.14">
3535
<PrivateAssets>all</PrivateAssets>
3636
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -51,16 +51,18 @@
5151
<ItemGroup>
5252
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
5353
<PackageReference Include="NuGet.Build.Tasks" Version="6.11.1"/>
54-
<PackageReference Include="Microsoft.Build.Framework" Version="17.11.4" IncludeAssets="all"/>
55-
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.11.4" IncludeAssets="all"/>
54+
<PackageReference Include="Microsoft.Build.Framework" Version="17.11.48" IncludeAssets="all"/>
55+
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.11.48" IncludeAssets="all"/>
56+
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.11.48" IncludeAssets="all"/>
5657
</ItemGroup>
5758
</When>
5859
<When Condition="'$(TargetFramework)'=='net9.0'">
5960
<ItemGroup>
6061
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.11" />
61-
<PackageReference Include="NuGet.Build.Tasks" Version="6.12.1"/>
62-
<PackageReference Include="Microsoft.Build.Framework" Version="17.12.6" IncludeAssets="all"/>
63-
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.12.6" IncludeAssets="all"/>
62+
<PackageReference Include="NuGet.Build.Tasks" Version="6.12.4"/>
63+
<PackageReference Include="Microsoft.Build.Framework" Version="17.12.50" IncludeAssets="all"/>
64+
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.12.50" IncludeAssets="all"/>
65+
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.12.50" IncludeAssets="all"/>
6466
</ItemGroup>
6567
</When>
6668
<Otherwise>
@@ -69,6 +71,7 @@
6971
<PackageReference Include="NuGet.Build.Tasks" Version="6.14.0"/>
7072
<PackageReference Include="Microsoft.Build.Framework" Version="18.0.2" IncludeAssets="all"/>
7173
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="18.0.2" IncludeAssets="all"/>
74+
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="18.0.2" IncludeAssets="all"/>
7275
</ItemGroup>
7376
</Otherwise>
7477
</Choose>

CSharpInteractive/CSharpInteractive.csproj

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</PropertyGroup>
2323

2424
<ItemGroup>
25-
<PackageReference Include="Microsoft.CodeAnalysis.Scripting" Version="5.0.0-2.final" />
25+
<PackageReference Include="Microsoft.CodeAnalysis.Scripting" Version="5.0.0" />
2626
<PackageReference Include="Pure.DI" Version="2.2.14">
2727
<PrivateAssets>all</PrivateAssets>
2828
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -41,18 +41,20 @@
4141
<Choose>
4242
<When Condition="'$(TargetFramework)'=='net8.0'">
4343
<ItemGroup>
44-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
44+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
4545
<PackageReference Include="NuGet.Build.Tasks" Version="6.11.1"/>
46-
<PackageReference Include="Microsoft.Build.Framework" Version="17.11.4" IncludeAssets="all"/>
47-
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.11.4" IncludeAssets="all"/>
46+
<PackageReference Include="Microsoft.Build.Framework" Version="17.11.48" IncludeAssets="all"/>
47+
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.11.48" IncludeAssets="all"/>
48+
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.11.48" IncludeAssets="all"/>
4849
</ItemGroup>
4950
</When>
5051
<When Condition="'$(TargetFramework)'=='net9.0'">
5152
<ItemGroup>
5253
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.11" />
53-
<PackageReference Include="NuGet.Build.Tasks" Version="6.12.1"/>
54-
<PackageReference Include="Microsoft.Build.Framework" Version="17.12.6" IncludeAssets="all"/>
55-
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.12.6" IncludeAssets="all"/>
54+
<PackageReference Include="NuGet.Build.Tasks" Version="6.12.4"/>
55+
<PackageReference Include="Microsoft.Build.Framework" Version="17.12.50" IncludeAssets="all"/>
56+
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.12.50" IncludeAssets="all"/>
57+
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.12.50" IncludeAssets="all"/>
5658
</ItemGroup>
5759
</When>
5860
<Otherwise>
@@ -61,6 +63,7 @@
6163
<PackageReference Include="NuGet.Build.Tasks" Version="6.14.0"/>
6264
<PackageReference Include="Microsoft.Build.Framework" Version="18.0.2" IncludeAssets="all"/>
6365
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="18.0.2" IncludeAssets="all"/>
66+
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="18.0.2" IncludeAssets="all"/>
6467
</ItemGroup>
6568
</Otherwise>
6669
</Choose>

Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<PropertyGroup>
33
<LangVersion>latest</LangVersion>
44
<Nullable>enable</Nullable>
5-
<NoWarn>NETSDK1138;NETSDK1057;NETSDK1215;NETSDK1045;NU1605;NU5118;NU5100;NU5131;NU5104;NU5105;NU1902;NU1903;NU1904;CS2008;CS1591</NoWarn>
65
<Version>1.0.0-dev</Version>
76
<Authors>NikolayP</Authors>
87
<PackageLicenseExpression>MIT</PackageLicenseExpression>
@@ -12,6 +11,8 @@
1211
<RepositoryType>git</RepositoryType>
1312
<RepositoryUrl>https://github.com/DevTeam/csharp-interactive</RepositoryUrl>
1413
<ImmutypeAPI>False</ImmutypeAPI>
14+
<NoWarn>NETSDK1215</NoWarn>
15+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1516
</PropertyGroup>
1617

1718
<ItemGroup>

0 commit comments

Comments
 (0)