Open
Description
Describe the bug
dotnet project convert
works incorrectly for target framework other than default base framework net10.0
To Reproduce
A WinForms sample and it works correctly with dotnet run Forms.cs
(assuming the file is saved as Forms.cs)
#:property TargetFramework net10.0-windows
#:property UseWindowsForms true
#:property OutputType WinExe
Application.Run(new Form() { Text = "Hello C#" });
When tried to convert it to a project with the command dotnet project convert Forms.cs
, the output contains duplicated content.
The default property of the base target framework is always included which is incorrect and it should be based on the file input.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net10.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<OutputType>WinExe</OutputType>
</PropertyGroup>
</Project>
Exceptions (if any)
None.
Further technical details
- 10.0.100-preview.4.25258.110
- CLI