No matter what configuration i am using i always see both files inside
the project
1.As we know, the UI in Solution Explorer is corresponding to content in .xxproj file. So when I write content like below:
<ItemGroup>
<Content Include="TextFile1.txt" />
</ItemGroup>
VS will display TextFile1.txt
in Solution Explorer even though the file actually doesn't exist.

So when you use the script above, it shows both two files.
2.And I think what confused you a lot is why the UI didn't include file depending on configurations. Please have a look at this similar issue, I agree with Andrey that ItemGroup
is also affected but this behavior.(Conditions not work when project loaded)
3.And in my opinion, It seems when VS load project file and display the UI in Solution Explorer,it can't access the Configuration value from the switch box. The switch box is disabled and grey when my project is unloaded, and if I right-click the project to reload it, since now the switch box is disbaled, the conditions about Configurations can't work well at load time.

Also, I tested this script, the three files are now displayed in Solution Explorer:
<ItemGroup>
<Content Include="TextFile1.txt" Condition="$(RootNamespace)=='App'"/>
<Content Include="TextFile2.txt" Condition="$(RootNamespace)=='AppApp'"/>
<Content Include="TextFile3.txt" Condition="$(RootNamespace)=='AppAppApp'"/>
</ItemGroup>
So it's obvious the conditions are ignored during load time. And according to the Note in remarks, this is by design.
And since conditions don't work in this situation, you may have to set its property manually in property window. i.e: Set the Package.release.appxmanifest
's build action as AppxManifest
while Package.debug.appxmanifest
's build action None
during Release configuration.
Hope it helps and if I misunderstand anything, feel free to correct me:)
Update1:
Find a discussion in github, and get the good hint from davkean.
The new project system currently drives the solution tree off the "active" configuration.
The old project system drives the solution tree by ignoring conditions. They both have advantages/disadvantages.