Sorry for crossposting this to two newsgroups, I assume the most
appropriate one is one of the vstudio ones, but csharp always have so
many more people so I hope this increases the chance of someone knowing
the answer.
I am trying to build a multi-file item template for my C# projects which
include the following files:
Controller.cs
Controller.Designer.cs
Controller.Interfaces.cs
Controller.Validation.cs
What I'd like is for the three bottommost files to be "beneath" the top
one, like Controller.Designer is.
Basically, after adding the above four files, my project contains this:
Controller1.cs
+- Controller1.Designer.cs
Controller1.Interfaces.cs
Controller1.Validation.cs
What I'd like is for the two bottom files to also be beneath, like this:
Controller1.cs
+- Controller1.Designer.cs
+- Controller1.Interfaces.cs
+- Controller1.Validation.cs
Now, I can go into the .csproj file, which contains the following entries:
<Compile Include="Test\Controller1.cs" />
<Compile Include="Test\Controller1.Designer.cs">
<DependentUpon>Controller1.cs</DependentUpon>
</Compile>
<Compile Include="Test\Controller1.Validation.cs" />
<Compile Include="Test\Controller1.Interfaces.cs" />
I can easily tweak the .csproj file by adding the <DependentUpon> tag
for the other two files as well, but my question is if I can do this
through the .vstemplate file.
This is the current contents of the .vstemplate file, at least the part
listing those files:
<ProjectItem ReplaceParameters="true" OpenInEditor="true">
Controller.cs
</ProjectItem>
<ProjectItem ReplaceParameters="true"
TargetFileName="$fileinputname$.Validation.cs" SubType="Validation">
Controller.Validation.cs
</ProjectItem>
<ProjectItem ReplaceParameters="true"
TargetFileName="$fileinputname$.Interfaces.cs" SubType="Interfaces">
Controller.Interfaces.cs
</ProjectItem>
<ProjectItem ReplaceParameters="true"
TargetFileName="$fileinputname$.Designer.cs" SubType="Designer">
Controller.Designer.cs
</ProjectItem>
Adding a sub-node of <DependentUpon> just gives me an error message
about an invalid path.
Is there anything I can do to my .vstemplate file that would give me the
right nodes in the .csproj file without having to manually tweak it?

Signature
Lasse Vågsæther Karlsen
mailto:lasse@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3
Michel LAPLANE (MVP) - 26 Feb 2008 17:41 GMT
I suspect that the dependent upon is only for file managed automatically
with the visual sutiod designer. Think of using Folder in your vstemplate
and csproj.
hope this can help.
> Sorry for crossposting this to two newsgroups, I assume the most
> appropriate one is one of the vstudio ones, but csharp always have so many
[quoted text clipped - 63 lines]
> Is there anything I can do to my .vstemplate file that would give me the
> right nodes in the .csproj file without having to manually tweak it?
Michel LAPLANE (MVP) - 27 Feb 2008 15:40 GMT
You can also use a macro with the AddFromTemplate method with powerful
features
Here is a useful link to help
http://msdn2.microsoft.com/en-us/library/7h8k229a.aspx
> Sorry for crossposting this to two newsgroups, I assume the most
> appropriate one is one of the vstudio ones, but csharp always have so many
[quoted text clipped - 63 lines]
> Is there anything I can do to my .vstemplate file that would give me the
> right nodes in the .csproj file without having to manually tweak it?