Skip to content

Commit

Permalink
Only infer winexe output type on net5.0 and greater
Browse files Browse the repository at this point in the history
  • Loading branch information
sfoslund committed Mar 22, 2021
1 parent 3e4313b commit 4e747d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Copyright (c) .NET Foundation. All rights reserved.

<PropertyGroup>
<_IsExecutable Condition="'$(OutputType)' == 'Exe' or '$(OutputType)'=='WinExe'">true</_IsExecutable>
<OutputType Condition="'$(DisableWinExeOutputInference)' != 'true' and '$(OutputType)' == 'Exe' and ('$(UseWindowsForms)' == 'true' or '$(UseWPF)' == 'true')">WinExe</OutputType>
</PropertyGroup>

<PropertyGroup Condition="'$(HasRuntimeOutput)' == ''">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,9 @@ Copyright (c) .NET Foundation. All rights reserved.
<OutputPath>$(OutputPath)$(TargetFramework.ToLowerInvariant())\</OutputPath>
</PropertyGroup>

<PropertyGroup>
<DisableWinExeOutputInference Condition="'$(DisableWinExeOutputInference)' == '' and ('$(TargetFrameworkIdentifier)' != '.NETCoreApp' or $([MSBuild]::VersionLessThan('$(TargetFrameworkVersion)', '5.0')))">true</DisableWinExeOutputInference>
<OutputType Condition="'$(DisableWinExeOutputInference)' != 'true' and '$(OutputType)' == 'Exe' and ('$(UseWindowsForms)' == 'true' or '$(UseWPF)' == 'true')">WinExe</OutputType>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ public void It_errors_on_nonwindows_with_a_framework_reference(string desktopFra

[WindowsOnlyTheory]
[InlineData("net5.0", "TargetPlatformIdentifier", "Windows", "Exe")]
[InlineData("netcoreapp3.1", "UseWindowsForms", "true", "WinExe")]
[InlineData("netcoreapp3.1", "UseWPF", "true", "WinExe")]
[InlineData("net5.0", "UseWindowsForms", "true", "WinExe")]
[InlineData("netcoreapp3.1", "UseWindowsForms", "true", "Exe")]
[InlineData("net5.0", "UseWPF", "true", "WinExe")]
[InlineData("netcoreapp3.1", "UseWPF", "true", "Exe")]
[InlineData("net5.0", "UseWPF", "false", "Exe")]
[InlineData("netcoreapp3.1", "UseWPF", "false", "Exe")]
public void It_infers_WinExe_output_type(string targetFramework, string propName, string propValue, string expectedOutputType)
{
Expand Down

0 comments on commit 4e747d5

Please sign in to comment.