Add "Add arm64 as a possible WinForms arch (#7457)" back (#8906)

This reverts commit a3fc14fd2e.
This commit is contained in:
Juan Hoyos 2020-10-16 09:39:31 -07:00 committed by GitHub
parent 3505317780
commit 53d412f76f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 2 deletions

View file

@ -114,6 +114,9 @@
<WindowsDesktop30RuntimePackRids Include="win-x64;win-x86" />
<WindowsDesktop31RuntimePackRids Include="@(WindowsDesktop30RuntimePackRids)" />
<WindowsDesktopRuntimePackRids Include="@(WindowsDesktop31RuntimePackRids)" />
<!-- TODO: remove this once WPF is available on ARM64 and replace usage
of this group for WindowsDesktopRuntimePackRids. -->
<WindowsDesktopRuntimePackWinformsRids Include="@(WindowsDesktopRuntimePackRids);win-arm64" />
</ItemGroup>
<!--
@ -262,7 +265,7 @@ Copyright (c) .NET Foundation. All rights reserved.
TargetingPackName="Microsoft.WindowsDesktop.App.Ref"
TargetingPackVersion="$(MicrosoftWindowsDesktopAppRefPackageVersion)"
RuntimePackNamePatterns="Microsoft.WindowsDesktop.App.Runtime.**RID**"
RuntimePackRuntimeIdentifiers="@(WindowsDesktopRuntimePackRids, '%3B')"
RuntimePackRuntimeIdentifiers="@(WindowsDesktopRuntimePackWinformsRids, '%3B')"
IsWindowsOnly="true"
Profile="WindowsForms"
/>

View file

@ -285,7 +285,7 @@
<PropertyGroup>
<IncludeWpfAndWinForms Condition=" '$(IncludeWpfAndWinForms)' == '' AND '$(Architecture)' == 'arm'">false</IncludeWpfAndWinForms>
<IncludeWpfAndWinForms Condition=" '$(IncludeWpfAndWinForms)' == '' AND '$(OS)' == 'Windows_NT' AND '$(Architecture)' != 'arm64' ">true</IncludeWpfAndWinForms>
<IncludeWpfAndWinForms Condition=" '$(IncludeWpfAndWinForms)' == '' AND '$(OS)' == 'Windows_NT'">true</IncludeWpfAndWinForms>
<IncludeWpfAndWinForms Condition=" '$(IncludeWpfAndWinForms)' == '' ">false</IncludeWpfAndWinForms>
</PropertyGroup>

View file

@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Xml.Linq;
using Microsoft.DotNet.TestFramework;
@ -82,6 +83,51 @@ namespace EndToEnd.Tests
.Should().Pass().And.HaveStdOutContaining("Hello World!");
}
[WindowsOnlyFact]
public void ItCanPublishArm64Winforms()
{
DirectoryInfo directory = TestAssets.CreateTestDirectory();
string projectDirectory = directory.FullName;
string newArgs = "winforms --no-restore";
new NewCommandShim()
.WithWorkingDirectory(projectDirectory)
.Execute(newArgs)
.Should().Pass();
string publishArgs="-r win-arm64";
new PublishCommand()
.WithWorkingDirectory(projectDirectory)
.Execute(publishArgs)
.Should().Pass();
var selfContainedPublishDir = new DirectoryInfo(projectDirectory)
.Sub("bin").Sub("Debug").GetDirectories().FirstOrDefault()
.Sub("win-arm64").Sub("publish");
selfContainedPublishDir.Should().HaveFilesMatching("System.Windows.Forms.dll", SearchOption.TopDirectoryOnly);
selfContainedPublishDir.Should().HaveFilesMatching($"{directory.Name}.dll", SearchOption.TopDirectoryOnly);
}
[WindowsOnlyFact]
public void ItCantPublishArm64Wpf()
{
DirectoryInfo directory = TestAssets.CreateTestDirectory();
string projectDirectory = directory.FullName;
string newArgs = "wpf --no-restore";
new NewCommandShim()
.WithWorkingDirectory(projectDirectory)
.Execute(newArgs)
.Should().Pass();
string publishArgs="-r win-arm64";
new PublishCommand()
.WithWorkingDirectory(projectDirectory)
.Execute(publishArgs)
.Should().Fail();
}
[Theory]
[InlineData("console")]
[InlineData("classlib")]