Skip to content

Commit

Permalink
Add "Add arm64 as a possible WinForms arch (dotnet#7457)" back
Browse files Browse the repository at this point in the history
This reverts commit a3fc14f.
  • Loading branch information
hoyosjs committed Oct 15, 2020
1 parent 3505317 commit 56bfee4
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/redist/targets/GenerateBundledVersions.targets
Original file line number Diff line number Diff line change
Expand Up @@ -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>

<!--
Expand Down Expand Up @@ -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"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/redist/targets/GenerateLayout.targets
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
46 changes: 46 additions & 0 deletions test/EndToEnd/ProjectBuildTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -82,6 +83,51 @@ public void ItCanRunAnAppUsingTheWebSdk()
.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")]
Expand Down

0 comments on commit 56bfee4

Please sign in to comment.