-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
I was trying to build a console app that accesses the clipboard. The easiest thing I could think of was this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>True</UseWindowsForms>
</PropertyGroup>
</Project>This compiles and runs, but the process isn't connected to the current console host, which causes no output to appear in the shell from which the console app was launched. I assume that's because the produced .exe uses the wrong subsystem.
I was able to work this around by not using UseWindowsForms and instead referencing the desktop framework:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.WindowsDesktop.App" />
</ItemGroup>
</Project>It seems to me that UseWindowsForms somehow overwrites the OutputType property. Is this expected behavior?
Unknown6656
Metadata
Metadata
Assignees
Labels
No labels