Skip to content

Commit 9984777

Browse files
authored
NuGet.CommandLine.XPlat should target net10.0 (#7039)
1 parent d8e33dd commit 9984777

14 files changed

Lines changed: 129 additions & 116 deletions

File tree

build/DotNetSdkVersions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Each line represents arguments for the .NET SDK installer script (https://learn.microsoft.com/dotnet/core/tools/dotnet-install-script)
2-
-Channel 9.0.3xx
2+
-Channel 10.0.1xx

build/common.project.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<NetStandardVersion>netstandard2.0</NetStandardVersion>
1414
<NETCoreTargetFramework>net8.0</NETCoreTargetFramework>
1515
<NETCoreTargetFramework Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(DotNetBuildFromVMR)' == 'true'">net10.0</NETCoreTargetFramework>
16-
<LatestNETCoreTargetFramework>net9.0</LatestNETCoreTargetFramework>
16+
<LatestNETCoreTargetFramework>net10.0</LatestNETCoreTargetFramework>
1717
<LatestNETCoreTargetFramework Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(DotNetBuildFromVMR)' == 'true'">net10.0</LatestNETCoreTargetFramework>
1818

1919
<!-- Target frameworks for class libraries-->
@@ -88,7 +88,7 @@
8888
<Features>strict</Features>
8989
<!-- Same as SDK default, but without CandidateAssemblyFiles in front, which would search in Content items -->
9090
<AssemblySearchPaths>{HintPathFromItem};{TargetFrameworkDirectory};{RawFileName}</AssemblySearchPaths>
91-
<LangVersion>12</LangVersion>
91+
<LangVersion>14</LangVersion>
9292
<LangVersion Condition="'$(DotNetBuildSourceOnly)' == 'true'">latest</LangVersion>
9393
</PropertyGroup>
9494

eng/pipelines/pr.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,20 @@ stages:
6868

6969
- ${{ if eq(parameters.RunUnitTestsOnWindows, true) }}:
7070
- stage:
71-
displayName: Unit Tests on Windows (.NET 9.0)
71+
displayName: Unit Tests on Windows (.NET 10.0)
7272
dependsOn: []
7373
jobs:
7474
- template: pr.job.yml
7575
parameters:
76-
displayName: Unit Tests on Windows (.NET 9.0)
76+
displayName: Unit Tests on Windows (.NET 10.0)
7777
osName: Windows
7878
${{ if eq(variables['System.TeamProject'], 'public') }}:
7979
agentPool: NetCore-Public
8080
agentDemands: ImageOverride -equals Windows.VS2022.Amd64.Open
8181
${{ else }}:
8282
agentPool: VSEngSS-MicroBuild2022-1ES
8383
testType: Unit
84-
testTargetFramework: net9.0
84+
testTargetFramework: net10.0
8585

8686
- ${{ if eq(parameters.RunFunctionalTestsOnWindows, true) }}:
8787
- stage:
@@ -160,93 +160,93 @@ stages:
160160

161161
- ${{ if eq(parameters.RunFunctionalTestsOnWindows, true) }}:
162162
- stage:
163-
displayName: Dotnet.Integration.Test on Windows (.NET 9.0)
163+
displayName: Dotnet.Integration.Test on Windows (.NET 10.0)
164164
dependsOn: []
165165
jobs:
166166
- template: pr.job.yml
167167
parameters:
168-
displayName: Dotnet.Integration.Test on Windows (.NET 9.0)
168+
displayName: Dotnet.Integration.Test on Windows (.NET 10.0)
169169
osName: Windows
170170
${{ if eq(variables['System.TeamProject'], 'public') }}:
171171
agentPool: NetCore-Public
172172
agentDemands: ImageOverride -equals Windows.VS2022.Amd64.Open
173173
${{ else }}:
174174
agentPool: VSEngSS-MicroBuild2022-1ES
175175
testType: Functional
176-
testTargetFramework: net9.0
176+
testTargetFramework: net10.0
177177
testProjectName: Dotnet.Integration.Test
178178
timeoutInMinutes: 60
179179

180180
- ${{ if eq(parameters.RunFunctionalTestsOnWindows, true) }}:
181181
- stage:
182-
displayName: NuGet.Packaging.FuncTest on Windows (.NET 9.0)
182+
displayName: NuGet.Packaging.FuncTest on Windows (.NET 10.0)
183183
dependsOn: []
184184
jobs:
185185
- template: pr.job.yml
186186
parameters:
187-
displayName: NuGet.Packaging.FuncTest on Windows (.NET 9.0)
187+
displayName: NuGet.Packaging.FuncTest on Windows (.NET 10.0)
188188
osName: Windows
189189
${{ if eq(variables['System.TeamProject'], 'public') }}:
190190
agentPool: NetCore-Public
191191
agentDemands: ImageOverride -equals Windows.VS2022.Amd64.Open
192192
${{ else }}:
193193
agentPool: VSEngSS-MicroBuild2022-1ES
194194
testType: Functional
195-
testTargetFramework: net9.0
195+
testTargetFramework: net10.0
196196
testProjectName: NuGet.Packaging.FuncTest
197197

198198
- ${{ if eq(parameters.RunUnitTestsOnLinux, true) }}:
199199
- stage:
200-
displayName: Unit Tests on Linux (.NET 9.0)
200+
displayName: Unit Tests on Linux (.NET 10.0)
201201
dependsOn: []
202202
jobs:
203203
- template: pr.job.yml
204204
parameters:
205-
displayName: Unit Tests on Linux (.NET 9.0)
205+
displayName: Unit Tests on Linux (.NET 10.0)
206206
osName: Linux
207207
vmImage: ubuntu-latest
208208
testType: Unit
209-
testTargetFramework: net9.0
209+
testTargetFramework: net10.0
210210

211211
- ${{ if eq(parameters.RunFunctionalTestsOnLinux, true) }}:
212212
- stage:
213-
displayName: Functional Tests on Linux (.NET 9.0)
213+
displayName: Functional Tests on Linux (.NET 10.0)
214214
dependsOn: []
215215
jobs:
216216
- template: pr.job.yml
217217
parameters:
218-
displayName: Functional Tests on Linux (.NET 9.0)
218+
displayName: Functional Tests on Linux (.NET 10.0)
219219
osName: Linux
220220
vmImage: ubuntu-latest
221221
testType: Functional
222-
testTargetFramework: net9.0
222+
testTargetFramework: net10.0
223223
timeoutInMinutes: 30
224224

225225
- ${{ if eq(parameters.RunUnitTestsOnMacOS, true) }}:
226226
- stage:
227-
displayName: Unit Tests on MacOS (.NET 9.0)
227+
displayName: Unit Tests on MacOS (.NET 10.0)
228228
dependsOn: []
229229
jobs:
230230
- template: pr.job.yml
231231
parameters:
232-
displayName: Unit Tests on MacOS (.NET 9.0)
232+
displayName: Unit Tests on MacOS (.NET 10.0)
233233
osName: MacOS
234234
vmImage: macos-14
235235
testType: Unit
236-
testTargetFramework: net9.0
236+
testTargetFramework: net10.0
237237

238238
- ${{ if eq(parameters.RunFunctionalTestsOnMacOS, true) }}:
239239
- stage:
240-
displayName: Functional Tests on MacOS (.NET 9.0)
240+
displayName: Functional Tests on MacOS (.NET 10.0)
241241
dependsOn: []
242242
jobs:
243243
- template: pr.job.yml
244244
parameters:
245-
displayName: Functional Tests on MacOS (.NET 9.0)
245+
displayName: Functional Tests on MacOS (.NET 10.0)
246246
osName: MacOS
247247
vmImage: macos-14
248248
testType: Functional
249-
testTargetFramework: net9.0
249+
testTargetFramework: net10.0
250250
timeoutInMinutes: 30
251251

252252
- ${{ if or(eq(parameters.RunSourceBuild, true), eq(parameters.RunStaticAnalysis, true)) }}:

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"sdk": {
3-
"version": "9.0.300",
3+
"version": "10.0.100",
44
"rollForward": "latestMajor",
55
"allowPrerelease": true
66
},
77
"tools": {
8-
"dotnet": "9.0.300",
8+
"dotnet": "10.0.100",
99
"pinned": true
1010
},
1111
"msbuild-sdks": {

test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NetworkCallCountTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ private Action<HttpListenerResponse> ServerHandler(
16641664
{
16651665
v2DownloadWait.Wait();
16661666

1667-
var id = parts.Reverse().Skip(1).First();
1667+
var id = parts.AsEnumerable().Reverse().Skip(1).First();
16681668
var version = parts.Last();
16691669

16701670
var file = new FileInfo(Path.Combine(repositoryPath, $"{id}.{version}.nupkg"));
@@ -1691,7 +1691,7 @@ private Action<HttpListenerResponse> ServerHandler(
16911691
}
16921692
else if (path.StartsWith("/reg/") && path.EndsWith("/index.json"))
16931693
{
1694-
var id = parts.Reverse().Skip(1).First();
1694+
var id = parts.AsEnumerable().Reverse().Skip(1).First();
16951695
var version = "1.0.0";
16961696

16971697
return new Action<HttpListenerResponse>(response =>

test/NuGet.Clients.Tests/NuGet.CommandLine.Test/RestoreNETCoreTest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
using NuGet.ProjectModel;
2525
using NuGet.Test.Utility;
2626
using NuGet.Versioning;
27+
using Test.Utility;
2728
using Xunit;
2829
using Xunit.Abstractions;
2930

@@ -9726,7 +9727,7 @@ public async Task RestoreNetCore_WithCustomAliases_WritesConditionWithCorrectAli
97269727
var project = SimpleTestProjectContext.CreateNETCoreWithSDK(
97279728
"proj",
97289729
pathContext.SolutionRoot,
9729-
"net9.0-windows");
9730+
$"{TestConstants.ProjectTargetFramework}-windows");
97309731

97319732
project.AddPackageToAllFrameworks(packageX);
97329733
solution.Projects.Add(project);
@@ -9745,7 +9746,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async(
97459746

97469747
var propsItemGroups = propsXML.Root.Elements().Where(e => e.Name.LocalName == "ItemGroup").ToList();
97479748

9748-
Assert.Contains("'$(TargetFramework)' == 'net9.0-windows' AND '$(ExcludeRestorePackageImports)' != 'true'", propsItemGroups[1].Attribute(XName.Get("Condition")).Value.Trim());
9749+
Assert.Contains($"'$(TargetFramework)' == '{TestConstants.ProjectTargetFramework}-windows' AND '$(ExcludeRestorePackageImports)' != 'true'", propsItemGroups[1].Attribute(XName.Get("Condition")).Value.Trim());
97499750
}
97509751
}
97519752

test/NuGet.Clients.Tests/NuGet.Indexing.Test/MergeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public void MultiMergeTest2()
164164
// pair-wise merging - but now in a different order - should be the same result
165165

166166
var result2 = Enumerable.Empty<string>();
167-
foreach (var l in data.Reverse())
167+
foreach (var l in data.AsEnumerable().Reverse())
168168
{
169169
result2 = result2.Merge(l.Select(ch => ch.ToString()), comparer);
170170
}

test/NuGet.Core.FuncTests/Dotnet.Integration.Test/Constants.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,11 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
5-
using NuGet.Frameworks;
65

76
namespace Dotnet.Integration.Test
87
{
98
internal static class Constants
109
{
11-
#if NET9_0
12-
// Specifies a target framework for projects used during testing. This should match the framework that the SDK being tested has.
13-
internal const string ProjectTargetFramework = "net10.0";
14-
internal static readonly NuGetFramework DefaultTargetFramework = NuGetFramework.Parse(ProjectTargetFramework);
15-
#else
16-
#error Update the logic for which target framework to use for tests projects!!!
17-
#endif
1810
internal static readonly Uri DotNetPackageSource = new("https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet7/nuget/v3/index.json");
1911
}
2012
}

test/NuGet.Core.FuncTests/Dotnet.Integration.Test/DotnetAddPackageTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using NuGet.Test.Utility;
1616
using NuGet.Versioning;
1717
using NuGet.XPlat.FuncTest;
18+
using Test.Utility;
1819
using Xunit;
1920
using Xunit.Abstractions;
2021

@@ -610,7 +611,7 @@ public void AddPkg_WhenSourceIsSignedPackageWithExpiredCertificatesAndWithTimest
610611
using (SimpleTestPathContext pathContext = new())
611612
{
612613
var projectName = "project";
613-
string targetFrameworks = Constants.DefaultTargetFramework.GetShortFolderName();
614+
string targetFrameworks = TestConstants.DefaultTargetFramework.GetShortFolderName();
614615
SimpleTestProjectContext projectA = XPlatTestUtils.CreateProject(projectName, pathContext, targetFrameworks);
615616

616617
// This package is important because:

0 commit comments

Comments
 (0)