Visual Studio 2022 is adding subfolders to the base output path.
Is there a way to prevent it from adding Release/Debug subfolders to the output path?
Visual Studio 2022 is adding subfolders to the base output path.
Is there a way to prevent it from adding Release/Debug subfolders to the output path?
The output path is a concatenation of a bunch of MSBuild properties. Depending on your project type, it can happen in the project file, in a targets file you import explicitly, or in an implicit import such as via an MSBuild SDK. In any of these cases, you should be able to override it by setting the value explicitly in your project file.
Taking the 3rd case as an example (using the Microsoft.NET.Sdk), in Microsoft.NET.DefaultOutputPaths.targets you'll find the defaults specified like this:
<BaseOutputPath Condition="'$(BaseOutputPath)' == ''">bin\</BaseOutputPath>
<BaseOutputPath Condition="!HasTrailingSlash('$(BaseOutputPath)')">$(BaseOutputPath)\</BaseOutputPath>
<OutputPath Condition="'$(OutputPath)' == '' and '$(PlatformName)' == 'AnyCPU'">$(BaseOutputPath)$(Configuration)\</OutputPath>
<OutputPath Condition="'$(OutputPath)' == '' and '$(PlatformName)' != 'AnyCPU'">$(BaseOutputPath)$(PlatformName)\$(Configuration)\</OutputPath>
<OutputPath Condition="!HasTrailingSlash('$(OutputPath)')">$(OutputPath)\</OutputPath>
Notice how the $(OutputPath) is basically appending the $(Configuration) to the $(BaseOutputPath).
If you want to always have the same output path, you can set <OutputPath>Your\Desired\Path</OutputPath> in your project file. Once you've set the value, this default logic above will be skipped based on the now-false condition ('$(OutputPath)' is no longer empty).
However, this may break incremental build if you build different configurations without deleting the contents of the output folder between builds.
I know this is an old question, but here's the full solution based on Microsoft's Debugger Settings:
PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath><OutputPath>C:\[full directory path]\[name of project]</OutputPath>