Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

Visual Studio custom template files, question about DependentUpon

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lasse Vågsæther Karlsen - 18 Feb 2008 14:01 GMT
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?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.