Because of huge advantages in NuGet packaging, I transformed the csproj file of a C# library to the new Visual Studio 2017 format as described here:
Old csproj to new csproj: Visual Studio 2017 upgrade guide.
Now all the xaml.cs and xaml files of my WPF usercontrols are being shown separatedly side by side and not in a structure (xaml.cs "inside" xaml). Additionally I can not switch between them via the context menu commands "view code" or "view designer".
I found out that I can solve the structural display with adding appropriate entries in the csproj file:
<Compile Include="SomeView.xaml.cs">
<DependentUpon>SomeView.xaml</DependentUpon>
</Compile>
After having saved the csproj file, it takes a second or two and then the two items are visually structured in the project explorer view.
I still cannot switch between them via context menu commands, though.
Additionally I get the error NETSDK1022 when compiling, telling about those compile elements being doubled now (the new project format automatically adds all suitable files). It is possible to disable this mechanism via setting EnableDefaultCompileItems to false, which works.
Is there a better way to "bind" the xaml and it's code-behind file for the new VS2017 project format?
(maybe this is one of the issues why the new project format is not yet released for window projects...)