Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port #7457 (Add arm64 as a possible WinForms arch) to preview 5 #7514

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/redist/targets/GenerateBundledVersions.targets
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,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 @@ -258,7 +261,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 @@ -283,7 +283,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
45 changes: 45 additions & 0 deletions test/EndToEnd/ProjectBuildTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,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