views:

259

answers:

2

Hi, I have created a multi plattform project, and everything works nicely, except one little things. When I add a specific plattform file, like:

  • ServiceImpl.cs
  • ServiceImpl.Desktop.cs

it does not show up nicely in a tree fashion like in this article:

Multi-Targeting (check the last image in the article to understand what I mean)..

Any ideas how to "teach" VS 2008 to do this? With normal XAML and Code-Behind it works as usual...


Ok, the answer worked perfect for a normal situation. Now, there is still a little problem with the silverlight project. The file is originally located in the desktop project, so there the solution works. However, if the "parent" file is a link, it seems to cause a problem (no effect at all)... See this code:

<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>

Any ideas for this situation?

+5  A: 

It doesn't always do it automatically (although it spots things like .Designer.), but you can edit the csproj by hand to do this (it is just xml). There are also a few add-ins that provide this, but the one I use has been removed. You want DependentUpon...

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

(note they must be in the same folder; you don't specify the folder in DependentUpon)

Marc Gravell
Thanks, worked... Still little problem with a linked file, see edit above.. Any idea about this?
Christian
+3  A: 

You can use this plugin http://mokosh.co.uk/vscommands/ to group items in solution explorer from VS (without editing project file).

jarek