Exporting and installing

In my last post, I said that I was hard at work on some new features that you will be able to use in Visual Studio 2005. So what do these features do? Imagine this scenario: You have created a really cool project, for example, a program for managing your DVD library. Not only does it keep track of the DVDs you own, but will use web services to communicate with online web sites to download information about those DVDs - including the actors, when it was published, and even other DVDs you may like. This program also allows you to rate the DVD, assigning 1 to 4 stars to it. All this data is then stored away into a database for retrieval at a later time.

 

Now suppose you like this program you wrote so much, that you want to share it with others. But you also want to distribute it in source form so that other users of Visual Studio can add their own features. Now you could zip up this project and then mail it to this other person, where they would unzip the project, load it into VS, and start developing. But what happens if you want to create multiple copies of this program? One version customized to a friend who likes action movies - maybe the background uses a screen capture of their favorite Schwarzennegger movie (or possibly has that name preprogrammed so you do not need to go to the web to find out how to spell it – like I had to). Or you want to create one version of this program for your 5 year old child which filters out any move not rated G. Or maybe you want to build multiple copies of this program because you want to sell them to local video stores, which will have computers that allows customers to browse the database to find DVDs they want to watch.

 

Each of these projects have the same starting code, but modified in a slightly different way – much like a project generated by a wizard. And that is the first of the tools, but I have already discussed that here. The template wizard will take a project (or project item) template and create a project from those templates, making replacements within the files changing specific tokens (like $projectname$) with the appropriate values. But this will only read in an existing project or project item template, how do you create your own template? You could open each file in the project, hand edit the files to place the replacement values, then generate a .vstemplate file (the file that is consumed by the template wizard) declaring all the files in the project. And lastly, you need to zip the files up and put them into a specific folder so that the templates will appear in the new project or add item dialog boxes. Test and repeat.

 

This is where the second new tool is useful. The Export Template Wizard will take either an open project or an item within that project, scan the files for possible replacements, generate the .vstemplate file, zip up the files, and finally put them into the required folder. This is a big productivity improvement for generating templates, simply create a project to meet your requirements, then export and use that project over and over again. Not only does this help in our DVD library program, but think of the other uses. Suppose you have a standard layout for a form in your company for viewing a database. You could build this project from the ground-up each time you need to create a view on the database, or you could hand create the project template, or you could build the project once then export the template.

 

Now you have the project templates (also known as a Starter Kit) generated for your DVD library program, but you want to share the code so that others can build their own custom DVD library program. You could send the Starter Kit file to somebody through email, the user would save the file to the special folder on disk, but what is that folder? There has to be an easier way, and there is with the third part of code that I have been working on, the VS Content Installer. The VS Content Installer takes a file with the extension either .vscontent or .vsi, and will install the content on a computer. A .vsi file is simply a .zip file renamed to have a new extension, and contains a .vscontent file as well as other data files such as a VS Template .zip file. The .vscontent file is a very simple XML file that gives the name, description, and files of what should be installed onto the computer. A user could download a .vsi file, double-click it, and the Content Installer will display UI letting you choose which items should be installed (a .vscontent file can describe more than one item to install) and also let you configure how those items are installed. The user receiving your .vsi file would not need to know how to manually install the contents, they would only know how to double click to get the templates for your DVD Starter Kit in the right place for VS to run it.

 

While we think people will share code like this, sending a .vsi file from one person to another, the real power is in the community space. Each of the language teams have a number of different Starter Kits planned that will be posted on MSDN that you will be able to download and increase your library of new project types. We have also been working with other community web sites (I don’t want to mention them right now since each of those web sites have plans on how they want to announce their participation, but I will list them here when available) to create areas where users could post their own Starter Kits. And of course, we want to make it easy for you to find Starter Kits on the web, so we will have a way to search for them within Visual Studio.

 

Starter Kits are not the only items that can be installed with the Content Installer. You will also be able to download .vsi files containing text editor snippets and Add-ins. Your company could package a .vsi file containing a set of Add-ins, snippets, project and project item templates, then post that .vsi file on the intranet for easy download and installing.

 

Lastly, suppose you have your own type component that is used by VS, but we don’t have a way of installing that component using the Content Installer. Examples would be a .vsi that contains a macro project or a VSIP package. While we don’t have any plans for extending the Content Installer for these types (it would be great to have these, but because of time constraints we don’t have plans for installing these types [but plans may change]), the Content Installer can be extended so that you can create your own installer types to install your component. Simply create a .NET User Control that implements an interface the Content Installer defines, and you can install any content you may wish. As I write this, I thought of another great installer type – an installer for debugger visualizers.

 

Oh, and we will be shipping a DVD application just like the one I wrote about here. You can read about it here.

 

There is more to the Content Installer, such as security measures so that you can sign a zip file and know where you are getting your content, and the managed zip library that I built to allow zipping and unzipping of files from within the Export Template Wizard and the Content Installer. Over time I will be talking about this a bit more, but let’s look at some screenshots. First, the export tool, and here is the first page:

 

 

Here, we can choose whether we should export a complete project, or just a set of items within the project. If we were to choose project, the last page is the following:

 

 

You can choose an icon to display in the new project dialog box, the name that is displayed in the dialog, as well as a description.

 

If you were to choose to export an item, you will see the next two pages of the wizard, and the final page is the previous one that we saw. These two pages will let you choose the items to export, as well as the references necessary for those items.

 

 

 

Completing the wizard, we will automatically make replacements on the files, then export the zip file into the correct place for you to start testing. Here, you can see I have exported two projects, WindowsApplication38a and WindowsApplication25. You did not need to do any work for these items to appear here other than running the wizard, everything else is taken care of for you.

 

 

Now suppose I created a .vsi file from a Console Application template. Double-clicking that .vsi starts the Content Installer, seen here:

 

 

After completing the Content Installer wizard, you will see a picture such as this one:

 

 

(Note that in this screen shot it failed because I already installed the content, and the wizard was just stating that the content was already installed).

 

Remember, what you see here is a work in progress, and may change over time, including features that are added or removed.

 

That is about it for this post. In the next few weeks I will write a bit more about these tools, and so will a few other VS Bloggers, so stay tuned!

Comments

  • Anonymous
    October 06, 2004
    Is this something already present in VS 2005 beta 1 ? Or can we do this another way in the mean time ?
    (btw - the screenshots don't work, I only get rexes :-))

    thanks,

    Stephane
    stephanetombeur@hotmail.com

  • Anonymous
    October 06, 2004
    This looks great. I'm currently (painfully) building enteprise templates for teams for 2005 starting in .NET. Guess I'll be able to toss those away once this is available (which is fine with me because I need something in the interim and willing to do the work). Keep up the excellent work you guys!

  • Anonymous
    October 08, 2004
    These tools are only available in VS Beta 2. This is so new, it is not even in our internal builds yet - they are scheduled to added to internal builds over the weekend.

  • Anonymous
    October 10, 2004
    BTW, it's Schwarzenegger :) There are a good number of sites that double the n, though, which is kind of weird.

    http://www.schwarzenegger.com/

  • Anonymous
    October 11, 2004
    DOH! I looked that up on IMDB.com, and it had nn. Checking on it now, it only has one.

  • Anonymous
    October 23, 2004
    The screenshots don't work. Anyway thanks ;-)

  • Anonymous
    November 01, 2004
    Templates are another example of SOP (Software for Other People). I don't need it, I don't see the use. BUT WAIT! Today I really need it! I'm using VB 2005 as the target language for a legacy source code conversion. My customers have gigabytes of source that needs to be accurately translated. The project is now complete in thanks to VB 2005 new features especially operator overloading. The legacy language has different operator behaviors than VB.

    The final touch is to create templates so translated VB code files can be grouped into a project and solution. To do so, I unzipped the console application project template, modified it for our purpose, copied to another location. Finally I wrote a program which uses AddFromTemplate() to create an instance of a project and solution. This is adequate for my purposes. Having the Export Template Wizard and Content Installer would have been slicker. Also, does/will AddFromTemplate be able to reference zipped template folders?

  • Anonymous
    November 02, 2004
    Aha, I found that you can access the templates contained in zipped folders using standard file paths. On my system I used C:Program FilesMicrosoft Visual Studio 8Common7IDEProjectTemplatesCacheVisualBasicWindows1033ConsoleApplication.zipconsoleapplication.vstemplate.

  • Anonymous
    May 15, 2006
    The comment has been removed

  • Anonymous
    June 19, 2009
    PingBack from http://mydebtconsolidator.info/story.php?id=12950

  • Anonymous
    August 17, 2009
    2vqPwj  <a href="http://aozwvcewwjna.com/">aozwvcewwjna</a>, [url=http://xemrzqjjztzp.com/]xemrzqjjztzp[/url], [link=http://ycnyzzevijhy.com/]ycnyzzevijhy[/link], http://nfxjobitwuxy.com/