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

Time:11-24

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]

CodePudding user response:

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).

  • Related