diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index df8f5882a94b..54fe8e6c1756 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -114,11 +114,6 @@ 4db6ac94ffa8bf6dae8ad9c5c68f94b58de917fd - - https://github.com/dotnet/runtime - 5108757b997c59ab8ba1fc5309ab0d4e730e2b77 - - https://github.com/dotnet/linker 4db6ac94ffa8bf6dae8ad9c5c68f94b58de917fd diff --git a/eng/Versions.props b/eng/Versions.props index 45c10e80b031..3a4406ea71fe 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -93,7 +93,6 @@ 8.0.0-alpha.1.22524.5 8.0.0-alpha.1.22524.5 8.0.0-alpha.1.22524.5 - 8.0.0-alpha.1.22524.5 diff --git a/src/Layout/redist/targets/BundledSdks.targets b/src/Layout/redist/targets/BundledSdks.targets index 6f8b0fc3b333..5b1fd3a195a0 100644 --- a/src/Layout/redist/targets/BundledSdks.targets +++ b/src/Layout/redist/targets/BundledSdks.targets @@ -5,6 +5,5 @@ - diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs index 9447c16cbd02..27bd7241c4de 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs @@ -104,6 +104,9 @@ public class ProcessFrameworkReferences : TaskBase [Output] public ITaskItem[] TargetILCompilerPacks { get; set; } + [Output] + public ITaskItem[] ImplicitPackageReferences { get; set; } + // Runtime packs which aren't available for the specified RuntimeIdentifier [Output] public ITaskItem[] UnavailableRuntimePacks { get; set; } @@ -621,6 +624,9 @@ private bool AddAotOrR2RRuntimePackage(AotPackageType packageType, Version norma else { HostILCompilerPacks = new[] { newItem }; + var ilCompilerBuildPackageReference = new TaskItem(knownPack.ItemSpec); + ilCompilerBuildPackageReference.SetMetadata(MetadataKeys.Version, packVersion); + ImplicitPackageReferences = new[] { ilCompilerBuildPackageReference }; // ILCompiler supports cross target compilation. If there is a cross-target request, we need to download that package as well // We expect RuntimeIdentifier to be defined during publish but can allow during build if (RuntimeIdentifier != null) @@ -633,17 +639,13 @@ private bool AddAotOrR2RRuntimePackage(AotPackageType packageType, Version norma if (!hostRuntimeIdentifier.Equals(targetRuntimeIdentifier)) { var runtimeIlcPackName = packPattern.Replace("**RID**", targetRuntimeIdentifier); - TaskItem targetIlcPackToDownload = new TaskItem(runtimeIlcPackName); - targetIlcPackToDownload.SetMetadata(MetadataKeys.Version, packVersion); - packagesToDownload.Add(targetIlcPackToDownload); - var newItem2 = new TaskItem(runtimeIlcPackName); newItem2.SetMetadata(MetadataKeys.NuGetPackageId, runtimeIlcPackName); newItem2.SetMetadata(MetadataKeys.NuGetPackageVersion, packVersion); TargetILCompilerPacks = new[] { newItem2 }; } } - } + } return true; } diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets index df564baca1a4..c66580e5e4e5 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets @@ -1,4 +1,4 @@ - + + <_ImplicitPackageReference Remove="@(PackageReference)" /> + + - - true - - diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs index 78d198b4e1f2..b1095087a0f5 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs @@ -27,6 +27,8 @@ public class GivenThatWeWantToPublishAnAotApp : SdkTest { private readonly string RuntimeIdentifier = $"/p:RuntimeIdentifier={RuntimeInformation.RuntimeIdentifier}"; + private readonly string ExplicitPackageVersion = "7.0.0-rc.2.22456.11"; + public GivenThatWeWantToPublishAnAotApp(ITestOutputHelper log) : base(log) { } @@ -272,7 +274,7 @@ public void NativeAot_hw_runs_with_PackageReference_PublishAot_is_enabled(string testProject.AdditionalProperties["PublishAot"] = "true"; // This will add a reference to a package that will also be automatically imported by the SDK - testProject.PackageReferences.Add(new TestPackageReference("Microsoft.DotNet.ILCompiler", "7.0.0-rc.2.22456.11")); + testProject.PackageReferences.Add(new TestPackageReference("Microsoft.DotNet.ILCompiler", ExplicitPackageVersion)); // Linux symbol files are embedded and require additional steps to be stripped to a separate file // assumes /bin (or /usr/bin) are in the PATH @@ -282,7 +284,7 @@ public void NativeAot_hw_runs_with_PackageReference_PublishAot_is_enabled(string } var testAsset = _testAssetsManager.CreateTestProject(testProject); - var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); + var publishCommand= new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); publishCommand .Execute($"/p:RuntimeIdentifier={rid}") .Should().Pass() @@ -307,6 +309,8 @@ public void NativeAot_hw_runs_with_PackageReference_PublishAot_is_enabled(string var command = new RunExeCommand(Log, publishedExe) .Execute().Should().Pass() .And.HaveStdOutContaining("Hello World"); + + CheckIlcVersions(Path.Combine(testAsset.TestRoot, testProject.Name), targetFramework, ExplicitPackageVersion); } } @@ -322,7 +326,7 @@ public void NativeAot_hw_runs_with_PackageReference_PublishAot_is_empty(string t var testProject = CreateHelloWorldTestProject(targetFramework, projectName, true); // This will add a reference to a package that will also be automatically imported by the SDK - testProject.PackageReferences.Add(new TestPackageReference("Microsoft.DotNet.ILCompiler", "7.0.0-rc.2.22456.11")); + testProject.PackageReferences.Add(new TestPackageReference("Microsoft.DotNet.ILCompiler", ExplicitPackageVersion)); // Linux symbol files are embedded and require additional steps to be stripped to a separate file // assumes /bin (or /usr/bin) are in the PATH @@ -373,7 +377,6 @@ public void NativeAot_hw_runs_with_cross_target_PublishAot_is_enabled(string tar var publishedExe = Path.Combine(publishDirectory, $"{testProject.Name}{Constants.ExeSuffix}"); File.Exists(publishedDll).Should().BeFalse(); File.Exists(publishedExe).Should().BeTrue(); - } } @@ -391,8 +394,8 @@ public void NativeAot_hw_runs_with_cross_PackageReference_PublishAot_is_enabled( testProject.AdditionalProperties["PublishAot"] = "true"; // This will add a reference to a package that will also be automatically imported by the SDK - testProject.PackageReferences.Add(new TestPackageReference("Microsoft.DotNet.ILCompiler", "7.0.0-rc.2.22456.11")); - testProject.PackageReferences.Add(new TestPackageReference("runtime.win-x64.Microsoft.DotNet.ILCompiler", "7.0.0-rc.2.22456.11")); + testProject.PackageReferences.Add(new TestPackageReference("Microsoft.DotNet.ILCompiler", ExplicitPackageVersion)); + testProject.PackageReferences.Add(new TestPackageReference("runtime.win-x64.Microsoft.DotNet.ILCompiler", ExplicitPackageVersion)); var testAsset = _testAssetsManager.CreateTestProject(testProject); @@ -409,6 +412,8 @@ public void NativeAot_hw_runs_with_cross_PackageReference_PublishAot_is_enabled( var publishedExe = Path.Combine(publishDirectory, $"{testProject.Name}{Constants.ExeSuffix}"); File.Exists(publishedDll).Should().BeFalse(); File.Exists(publishedExe).Should().BeTrue(); + + CheckIlcVersions(Path.Combine(testAsset.TestRoot, testProject.Name), targetFramework, ExplicitPackageVersion); } } @@ -424,8 +429,8 @@ public void NativeAot_hw_runs_with_cross_PackageReference_PublishAot_is_empty(st var testProject = CreateHelloWorldTestProject(targetFramework, projectName, true); // This will add a reference to a package that will also be automatically imported by the SDK - testProject.PackageReferences.Add(new TestPackageReference("Microsoft.DotNet.ILCompiler", "7.0.0-rc.2.22456.11")); - testProject.PackageReferences.Add(new TestPackageReference("runtime.win-x64.Microsoft.DotNet.ILCompiler", "7.0.0-rc.2.22456.11")); + testProject.PackageReferences.Add(new TestPackageReference("Microsoft.DotNet.ILCompiler", ExplicitPackageVersion)); + testProject.PackageReferences.Add(new TestPackageReference("runtime.win-x64.Microsoft.DotNet.ILCompiler", ExplicitPackageVersion)); var testAsset = _testAssetsManager.CreateTestProject(testProject); @@ -438,7 +443,6 @@ public void NativeAot_hw_runs_with_cross_PackageReference_PublishAot_is_empty(st var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var publishedDll = Path.Combine(publishDirectory, $"{projectName}.dll"); File.Exists(publishedDll).Should().BeTrue(); - } } @@ -476,7 +480,7 @@ public void NativeAot_hw_fails_with_sdk6_PackageReference_PublishAot_is_enabled( var testProject = CreateHelloWorldTestProject("net6.0", projectName, true); testProject.AdditionalProperties["PublishAot"] = "true"; - testProject.PackageReferences.Add(new TestPackageReference("Microsoft.DotNet.ILCompiler", "7.0.0-rc.2.22456.11")); + testProject.PackageReferences.Add(new TestPackageReference("Microsoft.DotNet.ILCompiler", ExplicitPackageVersion)); var testAsset = _testAssetsManager.CreateTestProject(testProject); @@ -700,6 +704,30 @@ public void It_publishes_with_implicit_rid_with_NativeAotApp(string targetFramew } } + private void CheckIlcVersions(string projectPath, string targetFramework, string expectedVersion) + { + // Compiler version matches expected version + var ilcToolsPathCommand = new GetValuesCommand(Log, projectPath, targetFramework, "IlcToolsPath") + { + DependsOnTargets = "WriteIlcRspFileForCompilation" + }; + ilcToolsPathCommand.Execute().Should().Pass(); + var ilcToolsPath = ilcToolsPathCommand.GetValues()[0]; + var ilcVersion = Path.GetFileName(Path.GetDirectoryName(Path.GetDirectoryName(ilcToolsPath))); + ilcVersion.Should().Be(ExplicitPackageVersion); + + // Compilation references (corelib) match expected version + var ilcReferenceCommand = new GetValuesCommand(Log, projectPath, targetFramework, "IlcReference", GetValuesCommand.ValueType.Item) + { + DependsOnTargets = "WriteIlcRspFileForCompilation" + }; + ilcReferenceCommand.Execute().Should().Pass(); + var ilcReference = ilcReferenceCommand.GetValues(); + var corelibReference = ilcReference.Where(r => Path.GetFileName(r).Equals("System.Private.CoreLib.dll")).Single(); + var ilcReferenceVersion = Path.GetFileName(Path.GetDirectoryName(Path.GetDirectoryName(corelibReference))); + ilcReferenceVersion.Should().Be(ExplicitPackageVersion); + } + private TestProject CreateHelloWorldTestProject(string targetFramework, string projectName, bool isExecutable) { var testProject = new TestProject()