Skip to content

Commit 62a5a83

Browse files
Merge release/10.0.1xx into darc-release/10.0.1xx-e9bea922-f8ce-4436-9aaa-17f29d5d144d
2 parents 4384670 + ffb7660 commit 62a5a83

File tree

9 files changed

+365
-294
lines changed

9 files changed

+365
-294
lines changed

NuGet.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<clear />
55
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
66
<!-- Begin: Package sources from dotnet-dotnet -->
7-
<add key="darc-pub-dotnet-dotnet-862de94" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-dotnet-862de94f/nuget/v3/index.json" />
7+
<add key="darc-pub-dotnet-dotnet-03ebd38" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-dotnet-03ebd38e/nuget/v3/index.json" />
88
<!-- End: Package sources from dotnet-dotnet -->
99
<!-- Begin: Package sources from microsoft-testfx -->
1010
<!-- End: Package sources from microsoft-testfx -->

eng/Version.Details.props

Lines changed: 72 additions & 72 deletions
Large diffs are not rendered by default.

eng/Version.Details.xml

Lines changed: 205 additions & 205 deletions
Large diffs are not rendered by default.

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
}
2222
},
2323
"msbuild-sdks": {
24-
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25514.103",
25-
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25514.103",
24+
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25515.107",
25+
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25515.107",
2626
"Microsoft.Build.NoTargets": "3.7.0",
2727
"Microsoft.Build.Traversal": "3.4.0",
2828
"Microsoft.WixToolset.Sdk": "5.0.2-dotnet.2737382"

src/Tasks/Microsoft.NET.Build.Tasks/GetPackagesToPrune.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,6 @@ static Dictionary<string, NuGetVersion> LoadPackagesToPruneFromFrameworkPackages
235235
{
236236
var nugetFramework = new NuGetFramework(targetFrameworkIdentifier, Version.Parse(targetFrameworkVersion));
237237

238-
// FrameworkPackages just has data for .NET Framework 4.6.1, so turn on fallback for anything greater than that so it will resolve to the .NET Framework 4.6.1 data
239-
if (!acceptNearestMatch && nugetFramework.IsDesktop() && nugetFramework.Version > new Version(4,6,1))
240-
{
241-
acceptNearestMatch = true;
242-
}
243-
244238
var frameworkPackages = FrameworkPackages.GetFrameworkPackages(nugetFramework, [frameworkReference], acceptNearestMatch)
245239
.SelectMany(packages => packages)
246240
.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ NOTE: This file is imported from the following contexts, so be aware when writin
5454
<_ToolRidsAreOnlyShims Condition="'$(RuntimeIdentifiers)' == '' and $(PackAsToolShimRuntimeIdentifiers) != '' ">true</_ToolRidsAreOnlyShims>
5555
<_UserSpecifiedToolPackageRids Condition="'$(ToolPackageRuntimeIdentifiers)' != ''">$(ToolPackageRuntimeIdentifiers)</_UserSpecifiedToolPackageRids>
5656
<_UserSpecifiedToolPackageRids Condition="'$(_UserSpecifiedToolPackageRids)' == ''">$(RuntimeIdentifiers)</_UserSpecifiedToolPackageRids>
57-
<_HasRIDSpecificTools Condition=" '$(_UserSpecifiedToolPackageRids)' != '' ">true</_HasRIDSpecificTools>
58-
<_HasRIDSpecificTools Condition="'$(_HasRIDSpecificTools)' == ''">false</_HasRIDSpecificTools>
57+
<CreateRidSpecificToolPackages Condition="'$(CreateRidSpecificToolPackages)' == '' And '$(_UserSpecifiedToolPackageRids)' != '' ">true</CreateRidSpecificToolPackages>
58+
<CreateRidSpecificToolPackages Condition="'$(CreateRidSpecificToolPackages)' == ''">false</CreateRidSpecificToolPackages>
5959

6060
<!-- NOTE: this line is load-bearing. This impacts Restore behaviors significantly, so we can't prevent the import of these targets _in general_. -->
6161
<RuntimeIdentifiers Condition="'$(PackAsToolShimRuntimeIdentifiers)' != ''">$(_UserSpecifiedToolPackageRids);$(PackAsToolShimRuntimeIdentifiers)</RuntimeIdentifiers>
@@ -65,7 +65,7 @@ NOTE: This file is imported from the following contexts, so be aware when writin
6565
<!-- We need to know if the inner builds are _intended_ to be AOT even if we then explicitly disable AOT for the outer builds.
6666
Knowing this lets us correctly decide to create the RID-specific inner tools or not when packaging the outer tool. -->
6767
<_InnerToolsPublishAot>false</_InnerToolsPublishAot>
68-
<_InnerToolsPublishAot Condition="$(_HasRIDSpecificTools) and '$(PublishAot)' == 'true'">true</_InnerToolsPublishAot>
68+
<_InnerToolsPublishAot Condition="$(CreateRidSpecificToolPackages) and '$(PublishAot)' == 'true'">true</_InnerToolsPublishAot>
6969

7070
<!-- determining if it's safe to change publish-related properties for this evaluation. We can only override default publishing
7171
behavior if
@@ -164,7 +164,7 @@ NOTE: This file is imported from the following contexts, so be aware when writin
164164
</PropertyGroup>
165165

166166
<!-- inner-build tool packages get a RID suffix -->
167-
<PropertyGroup Condition="'$(_HasRIDSpecificTools)' != '' And '$(RuntimeIdentifier)' != ''">
167+
<PropertyGroup Condition="$(CreateRidSpecificToolPackages) And '$(RuntimeIdentifier)' != ''">
168168
<PackageId>$(PackageId).$(RuntimeIdentifier)</PackageId>
169169
</PropertyGroup>
170170
</Target>
@@ -390,7 +390,7 @@ NOTE: This file is imported from the following contexts, so be aware when writin
390390
<Target Name="SetDotnetToolPackageType" Returns="$(_ToolPackageType)">
391391

392392
<PropertyGroup>
393-
<_ToolPackageType Condition="'$(RuntimeIdentifier)' != '' And '$(_HasRIDSpecificTools)' != ''">DotnetToolRidPackage</_ToolPackageType>
393+
<_ToolPackageType Condition="'$(RuntimeIdentifier)' != '' And $(CreateRidSpecificToolPackages)">DotnetToolRidPackage</_ToolPackageType>
394394
<_ToolPackageType Condition="'$(_ToolPackageType)' == ''">DotnetTool</_ToolPackageType>
395395
</PropertyGroup>
396396

@@ -427,7 +427,7 @@ NOTE: This file is imported from the following contexts, so be aware when writin
427427
We can't call this for AOT'd tools because we can't AOT cross-architecture and cross-platform in .NET today. -->
428428
<Target Name="_CreateRIDSpecificToolPackages"
429429
Condition="'$(RuntimeIdentifier)' == ''
430-
and $(_HasRIDSpecificTools)
430+
and $(CreateRidSpecificToolPackages)
431431
and !$(_InnerToolsPublishAot)">
432432
<PropertyGroup>
433433
<_PackageRids>$(ToolPackageRuntimeIdentifiers)</_PackageRids>

test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithoutTransitiveProjectRefs.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public void It_cleans_the_project_successfully_with_static_graph_and_isolation()
8282
"1.exe",
8383
"1.pdb",
8484
"1.exe.config",
85+
"System.Diagnostics.DiagnosticSource.dll",
8586
};
8687

8788
foreach (var targetFramework in targetFrameworks)

test/Microsoft.NET.Build.Tests/GivenThatWeWantToResolveConflicts.cs

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ public void PlatformPackagesCanBePruned(bool prunePackages)
329329
[InlineData("netstandard1.1", false)]
330330
[InlineData("netstandard1.0", false)]
331331
[InlineData("net451", false)]
332-
[InlineData("net462")]
333-
[InlineData("net481")]
332+
[InlineData("net462", false)]
333+
[InlineData("net481", false)]
334334
// These target frameworks shouldn't prune packages unless explicitly enabled
335335
[InlineData("net9.0", false, "")]
336336
[InlineData("netstandard2.1", false, "")]
@@ -492,6 +492,45 @@ public void WithMultitargetedProjects_PruningsDefaultsAreApplies(string framewor
492492
}
493493
}
494494

495+
[Fact]
496+
public void WithMultitargetedProject_NETFrameworkIsNotPruned()
497+
{
498+
var project = new TestProject("MultitargetedPruning")
499+
{
500+
TargetFrameworks = ToolsetInfo.CurrentTargetFramework + ";net462",
501+
};
502+
project.PackageReferences.Add(new TestPackageReference("System.ValueTuple", "4.6.1"));
503+
project.SourceFiles.Add("Test.cs", @"
504+
public class Class1
505+
{
506+
public (int, int) GetTuple() => (1, 2);
507+
}
508+
");
509+
var testAsset = _testAssetsManager.CreateTestProject(project, identifier: "NETFrameworkIsNotPruned");
510+
var buildCommand = new BuildCommand(testAsset);
511+
buildCommand.Execute().Should().Pass();
512+
var assetsFilePath = Path.Combine(buildCommand.GetBaseIntermediateDirectory().FullName, "project.assets.json");
513+
var lockFile = LockFileUtilities.GetLockFile(assetsFilePath, new NullLogger());
514+
515+
foreach (var lockFileTarget in lockFile.Targets)
516+
{
517+
var valueTupleLibrary = lockFileTarget.Libraries.Where(library => library.Name.Equals("System.ValueTuple", StringComparison.OrdinalIgnoreCase)).Single();
518+
var runtimeAssemblies = valueTupleLibrary.RuntimeAssemblies.Where(a => !Path.GetFileName(a.Path).Equals("_._"));
519+
var compileTimeAssemblies = valueTupleLibrary.CompileTimeAssemblies.Where(a => !Path.GetFileName(a.Path).Equals("_._"));
520+
521+
if (lockFileTarget.TargetFramework.Framework.Equals(".NETFramework", StringComparison.OrdinalIgnoreCase))
522+
{
523+
runtimeAssemblies.Should().NotBeEmpty();
524+
compileTimeAssemblies.Should().NotBeEmpty();
525+
}
526+
else
527+
{
528+
runtimeAssemblies.Should().BeEmpty();
529+
compileTimeAssemblies.Should().BeEmpty();
530+
}
531+
}
532+
}
533+
495534
static List<KeyValuePair<string, string>> ParsePrunePackageReferenceJson(string json)
496535
{
497536
List<KeyValuePair<string, string>> ret = new();

test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProject.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,5 +323,42 @@ public void Given_targetplatform_set_It_should_error()
323323
result.Should().Fail().And.HaveStdOutContaining("NETSDK1146");
324324

325325
}
326+
327+
[Fact]
328+
public void It_packs_with_RuntimeIdentifier()
329+
{
330+
var testProject = new TestProject("ToolWithRuntimeIdentifier")
331+
{
332+
TargetFrameworks = ToolsetInfo.CurrentTargetFramework,
333+
IsExe = true,
334+
RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid()
335+
};
336+
testProject.AdditionalProperties["PackAsTool"] = "true";
337+
testProject.AdditionalProperties["ImplicitUsings"] = "enable";
338+
testProject.AdditionalProperties["CreateRidSpecificToolPackages"] = "false";
339+
testProject.AdditionalProperties["UseAppHost"] = "false";
340+
341+
342+
var testAsset = _testAssetsManager.CreateTestProject(testProject);
343+
344+
var packCommand = new PackCommand(testAsset);
345+
346+
packCommand.Execute().Should().Pass();
347+
348+
packCommand.GetPackageDirectory().Should().HaveFile($"{testProject.Name}.1.0.0.nupkg");
349+
packCommand.GetPackageDirectory().Should().NotHaveFile($"{testProject.Name}.{testProject.RuntimeIdentifier}.1.0.0.nupkg");
350+
351+
var nupkgPath = packCommand.GetNuGetPackage();
352+
353+
using (var nupkgReader = new PackageArchiveReader(nupkgPath))
354+
{
355+
var toolSettingsItem = nupkgReader.GetToolItems().SelectMany(g => g.Items).SingleOrDefault(i => i.Equals($"tools/{testProject.TargetFrameworks}/{testProject.RuntimeIdentifier}/DotnetToolSettings.xml"));
356+
toolSettingsItem.Should().NotBeNull();
357+
358+
var toolSettingsXml = XDocument.Load(nupkgReader.GetStream(toolSettingsItem));
359+
toolSettingsXml.Root.Attribute("Version").Value.Should().Be("1");
360+
}
361+
362+
}
326363
}
327364
}

0 commit comments

Comments
 (0)