Given a VS solution content (Solution.sln) content:
...
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SomeModule1", "SomeModule1\SomeModule1.csproj", "{SomeModule1 GUID}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SomeModule2", "SomeModule2\SomeModule2.csproj", "{SomeModule2 GUIDB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SomeModuleX", "SomeModuleX\SomeModuleX.csproj", "{SomeModuleX GUID}"
EndProject
...
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_X|Any CPU = Debug_X|Any CPU
Debug_2|Any CPU = Debug_2|Any CPU
Debug_1|Any CPU = Debug_1|Any CPU
...
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{SomeModule2 GUID}.Debug_X|Any CPU.ActiveCfg = Debug_X|Any CPU
{SomeModule2 GUID}.Debug_X|Any CPU.Build.0 = Debug_X|Any CPU
{SomeModuleX GUID}.Debug_X|Any CPU.ActiveCfg = Debug_X|Any CPU
{SomeModuleX GUID}.Debug_X|Any CPU.Build.0 = Debug_X|Any CPU
...
{SomeModule1 GUID}.Debug_2|Any CPU.ActiveCfg = Debug_2|Any CPU
{SomeModule1 GUID}.Debug_2|Any CPU.Build.0 = Debug_2|Any CPU
{SomeModuleX GUID}.Debug_2|Any CPU.ActiveCfg = Debug_2|Any CPU
{SomeModuleX GUID}.Debug_2|Any CPU.Build.0 = Debug_2|Any CPU
...
{SomeModule1 GUID}.Debug_1|Any CPU.ActiveCfg = Debug_1|Any CPU
{SomeModule1 GUID}.Debug_1|Any CPU.Build.0 = Debug_1|Any CPU
{SomeModule2 GUID}.Debug_1|Any CPU.ActiveCfg = Debug_1|Any CPU
{SomeModule2 GUID}.Debug_1|Any CPU.Build.0 = Debug_1|Any CPU
...
And a Standard.props file found in solution (this is imported in every VS project via <Import Project="..\Standard.props" />
) :
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
...
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug_1|AnyCPU'">
...
<OutputPath>D:\ProjectPath1\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug_2|AnyCPU'">
...
<OutputPath>D:\ProjectPath2\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug_X|AnyCPU'">
...
<OutputPath>D:\ProjectPathX\</OutputPath>
</PropertyGroup>
...
</Project>
For the sake of the example, let's say that i work on SomeModule1.csproj with the configuration Debug_1 that builds the assembly on path D:\ProjectPath1\
with a structure like this:
├── ProjectPath1\
│ ├── SomeModule1\...
│ ├── SomeModule2\...
│ ├── SomeModuleX\ (empty folder, is not selected for building in 'Debug_1')
Current situation:
Me and my team work on Solution.sln that consists in 35 projects (see upper partial example) that has multiple solution configurations (see upper partial example). Each configuration has his own output path where the VS build the files into.
The problem:
Every time i change the active configuration without building it VS recreates all the paths from its output
path with empty folders for the current configuration. Also, it creates an empty folder for SomeModuleX
that is not included in Debug_1
solution configuration
Example: If i change from Debug_1 to any other, let's say Debug_2 and some empty folders appears on my drive:
├── ProjectPath1\
│ ├── SomeModule1\... (my folders)
│ ├── SomeModule2\... (my folders)
│ ├── SomeModuleX\ (empty folder, is not selected for building in 'Debug_1')
├── ProjectPath2\
│ ├── SomeModule1\ (empty folders)
│ ├── SomeModule2\ (empty folders)
│ ├── SomeModuleX\ (empty folders)
If i change to Debug_X some other empty folders appears on my drive:
├── ProjectPath1\
│ ├── SomeModule1\... (my folders)
│ ├── SomeModule2\... (my folders)
│ ├── SomeModuleX\ (empty folder, is not selected for building in 'Debug_1')
├── ProjectPath2\
│ ├── SomeModule1\ (empty folders)
│ ├── SomeModule2\ (empty folders)
│ ├── SomeModuleX\ (empty folders)
├── ProjectPathX\
│ ├── SomeModule2\ (empty folders)
│ ├── SomeModule2\ (empty folders)
│ ├── SomeModuleX\ (empty folders)
If i delete ProjectPath2
and ProjectPath3
folders and change between solution configurations, the folders appears again...
What can i do?
So, what can i do to avoid this? Is there any settings in VS that i can modify? I tried IntermediateOutputPath
with no luck. I will mention that, in our situation, we can't use the Working Directory
from Debug
settings?
I admit this isn't a show-stopper, but it drives me crazy sometimes the fact that i have a bunch of empty folders (equals with the number of configurations) on my drive (yeah, i know, OCD).
Long story, short:
How do i tell Visual Studio: "Do not create empty folder of the <OutputPath>Path</OutputPath>
unless i press Build or Rebuild command!"?
LE: Issue submitted to MS here (link) for anyone interested about this subject