Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is 'net6.0-windows' sub folder created?

I am using visual studio 2022 and created a winforms .net 6 application. I specified an output path for my release build where i want the .exe created, but visual studio creates a subfolder called 'net6.0-windows' and puts the exe in there. How do i stop this and get it to put the exe where I specified?

Some background: I am upgrading a .Net Framework 4.8 Winforms to .Net 6. In .net framework it puts the exe in the output folder specified (no subfolders). I want to keep with the same behavior because other files and utilities also need to be in there or look in that folder.

Output path specified in visual studio

[Output path specified in visual studio]

Actual output path

[Actual output path]

like image 201
Possibility Avatar asked Nov 16 '25 03:11

Possibility


1 Answers

I'll provide the following information for reference and sake of answering the question.

You can prevent that the TargetFramework is added to the output folder by adding the following property to your project file.

<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

Additionally, you can prevent a RuntimeIndentifier (e.g. win-x64), if any, to be added setting this property to false:

<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>

Should you do this?

Maybe not. Those directories are there for a reason: to allow multiple TargetFramework (versions) and/or multiple RuntimeIndentifier in parallel (otherwise outputs would mix in a unholy manner).

like image 108
Christian.K Avatar answered Nov 18 '25 21:11

Christian.K



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!