获取VS2008为“树缩进”分部类(如代码隐藏文件)(Get VS2008 to “tree-ind

2019-09-17 00:21发布

我创建了一个多plattform的项目,一切都工作得很好,除了一个小东西。 当我添加特定的plattform的文件,如:

  • ServiceImpl.cs
  • ServiceImpl.Desktop.cs

它不会在一棵树上的方式喜欢这篇文章中很好地显示出来:

多目标 (查看最后图像在文章中明白我的意思)..

任何想法如何“教” VS 2008年做到这一点? 随着正常的XAML和代码隐藏它的工作像往常一样...


好吧,答案为正常情况下的工作完美。 现在,仍与Silverlight项目有点问题。 该文件最初位于桌面项目,所以那里的解决方案工作。 但是,如果“父”文件是一个链接,它似乎会导致一个问题(无任何影响)......看到这个代码:

<Compile Include="..\Messaging\Services\MessagingService.cs">
  <Link>Services\MessagingService.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\MessagingService.Silverlight.cs">
      <DependentUpon>MessagingService.cs</DependentUpon>
</Compile>

任何想法对于这种情况?

Answer 1:

它并不总是这样做,它会自动(尽管它景点,如.Designer的东西。),但您可以通过手工编辑的csproj做到这一点(这只是XML)。 也有提供这几个加载项,但是我用的是一个已被删除。 你想DependentUpon ...

<Compile Include="ServiceImpl.cs" />
<Compile Include="ServiceImpl.Desktop.cs">
  <DependentUpon>ServiceImpl.cs</DependentUpon>
</Compile>

(注意,它们必须在同一个文件夹,你不指定DependentUpon的文件夹)



Answer 2:

你可以使用这个插件http://mokosh.co.uk/vscommands/从VS解决方案资源管理项目组(无编辑项目文件)。



文章来源: Get VS2008 to “tree-indent” partial classes (like code-behind files)