Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8936185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:09:46+00:00 2026-06-15T10:09:46+00:00

I would like to create a feature that allows me to automatically add a

  • 0

I would like to create a feature that allows me to automatically add a few related files to my C# project. I want to create a new form based on a template, and create an XML file and add it to a separate sub-directory within the project. How would I go about doing this? I see that there are wizards, add-ins, macros, etc. available in Visual Studio 2008, but I do not know which is most appropriate for my needs. I thought a wizard would work, but that may be overkill. I just want to remove the repetitiveness of copying from an existing set of files within the same project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:09:47+00:00Added an answer on June 15, 2026 at 10:09 am

    You can export individual project items as zipped templates using the menu File|Export Template… in VS2010. To create a template with multiple files, you can export the first item, then add additional items to the resulting template zip. You’ll also need to edit the .vstemplate file in the zip to include the additional items.

    As an example, I exported a form from a existing project and then added an xml file. The resulting zip file contains the files

    __TemplateIcon.ico
    Form1.cs
    Form1.Designer.cs
    Form1.resx
    MyTemplate.vstemplate
    xmldata.xml

    The .vstemplate file contains the following xml:

    <VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
      <TemplateData>
        <DefaultName>TwoFileTemplate</DefaultName>
        <Name>TwoFileTemplate</Name>
        <Description>Test template</Description>
        <ProjectType>CSharp</ProjectType>
        <SortOrder>10</SortOrder>
        <Icon>__TemplateIcon.ico</Icon>
      </TemplateData>
      <TemplateContent>
        <References />
        <ProjectItem SubType="" TargetFileName="xml\$fileinputname$.xml" ReplaceParameters="true">xmldata.xml</ProjectItem>
        <ProjectItem SubType="Form" TargetFileName="$fileinputname$.cs" ReplaceParameters="true">Form1.cs</ProjectItem>
        <ProjectItem SubType="" TargetFileName="$fileinputname$.Designer.cs" ReplaceParameters="true">Form1.Designer.cs</ProjectItem>
        <ProjectItem SubType="" TargetFileName="$fileinputname$.resx" ReplaceParameters="true">Form1.resx</ProjectItem>
      </TemplateContent>
    </VSTemplate>
    

    Once you’ve updated the zip file, move it to the folder …\Visual Studio 2010\Templates\ItemTemplates.

    The new template should now show up in the Add New Item dialog in VS2010. It will add the form and xml file with whatever name you specify when adding the new item to the project and will put the xml file in a directory named ‘xml’. If you want a fixed name for one or the other of the files you can replace $fileinputnam$ in the .vstemplate file with the desired name.

    Edit – If you want a fixed item name for a form or other class file you’ll also need to open the code templates and replace $safeitemname$ with the desired name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm still new to Javascript and would like to create a 'pages' feature for
Essentially, I would like to create a database structure that allows for classifying an
I would like to create a c++ type that mimic the build-in type exactly.
I would like to create a class that runs something (a runnable) at regular
I would like to create a virtual host in apache2, but I want it
We'd like to create something within SharePoint that would allow to ensure a set
I would like to implement a save feature, which allows my users to save
i would like create a array of structure which have a dynamic array :
I would like to create this shape using just css. I am pretty sure
I would like to create a json object to send as a post array,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.