Udostępnij za pośrednictwem


How to: Package Community Components to Use the Visual Studio Content Installer

You can create and share items for use in Visual Studio. Types of items can include starter kits, macros, code snippets, or add-ins, among others. To make it easier for other developers to use your item within Visual Studio, you can package the item in a .vsi file, which is typically referred to as a community component, so that it can be installed by using the Visual Studio Content Installer. The Visual Studio Content Installer automatically copies the items in community components to the correct directories on a developer's computer so that the items appear in the correct dialog boxes in Visual Studio.

To use the Visual Studio Content Installer to install your community components, you must create a .vscontent file for the component. After you create the .vscontent file, you compress the component files and the .vscontent file into a .zip file and change the file name extension from .zip to .vsi. You then can distribute the .vsi file to other developers by using whatever method that you decide, such as making the file available for download from the Web, sending the file as an e-mail attachment, or posting the file on a network share.

.Vscontent Files

.Vscontent files use XML that is based on the Visual Studio Content Installer Schema Reference to describe components that you have created and intend to share. At the minimum, the .vscontent file identifies the kind of components and the version of Visual Studio that the componens should be used with. After you have authored a .vscontent file, you can create the .vsi file that Visual Studio Content Installer will use to install the components on a developer's computer.

To create a basic .vscontent file

  1. On the File menu, point to New and then click File.

  2. In the General category, select XML File and then click Open.

  3. Create a valid .vscontent file by using the Visual Studio Content Installer Schema Reference.

    Note

    Sample XML for .vscontent files can be found in the Example sections of this topic.

  4. Save the .vscontent file in the same directory as the other files that are related to the community component.

.VSI Files

Visual Studio Content Installer (.vsi) files are used to exchange Visual Studio content in the developer community. A .vsi file is a renamed .zip file that contains these components:

  • An XML .vscontent file that describes the community component.

  • The files for the component.

The Visual Studio Content Installer uses .vsi files to install shared content to the correct location. For more information about how to install .vsi files, see How to: Install Community Components.

Some features of the Visual Studio Content Installer require additional tools or services to implement.

  • To display publisher information for your community component in the Visual Studio Content Installer, you must sign the .vsi file. For more information, see Cryptography Overview.

  • To display an End User License Agreement (EULA) in the Visual Studio Content Installer, you must embed this information in the .zip file. WinZip supports including embedded information through the Comment feature. For more information about WinZip, see http://www.winzip.com. For more information about the Comment feature, see the WinZip Help file.

To create a basic .vsi file

  1. If you have not done so already, create a valid .vscontent file for the component. For more information, see the section .VSCONTENT Files found earlier in this topic.

  2. In Windows Explorer, select the files that are required for the component, including the .vscontent file.

  3. Right-click the selected files, point to Send To, and click Compressed (zipped) Folder.

    The selected files are compressed into a single .zip file.

  4. Rename the extension of the .zip file to .vsi.

Example

The following example shows a .vscontent file for a .vsi file that contains an add-in that must be used with Visual Studio 2008 only. The following files would be included in the .vsi file for this content:

  • A .vscontent file that contains the XML shown in this example.

  • The add-in registration file MyAddin.Addin.

  • The compiled add-in .dll file MyAddin.dll.

The add-in files are installed in the following directory:

n:\...\My Documents\Visual Studio <version>\Addins\

For additional examples, see How to: Publish Project Templates and How to: Publish Code Snippets.

<VSContent xmlns="https://schemas.microsoft.com/developer/vscontent/2005"> 
    <Content>
        <FileName>MyAddin.Addin</FileName>
        <FileName>MyAddin.dll</FileName>
        <DisplayName>Example Add-in</DisplayName>
        <Description>An add-in created for this example.</Description>
        <FileContentType>Addin</FileContentType>
        <ContentVersion>2.0</ContentVersion>
    </Content>
</VSContent>

The following example shows a .vscontent file for a .vsi file that contains a macro project that can be used with either Visual Studio 2005 or Visual Studio 2008. The following files would be included in the .vsi file for this content:

  • A .vscontent file that contains the XML shown in this example.

  • The macro file MyMacroProject.vsmacros.

The macro file is installed in the following directory:

n:\...\My Documents\Visual Studio <version>\Projects\VSMacros80\

<VSContent xmlns="https://schemas.microsoft.com/developer/vscontent/2005">
    <Content>
        <FileName>MyMacroProject.vsmacros</FileName>
        <DisplayName>My Macro Project</DisplayName>
        <Description> A macro project created for this example.</Description>
        <FileContentType>Macro Project</FileContentType>
        <ContentVersion>1.0</ContentVersion>
    </Content>
</VSContent>

See Also

Tasks

How to: Publish Project Templates

How to: Publish Code Snippets

Other Resources

Interacting with Other Developers