How to: Create a .Vsct File
There are several ways to create an XML-based Visual Studio Command Table configuration (.vsct) file.
You can create a new VSPackage in the Visual Studio Package Template.
You can use the XML-based command table configuration compiler, Vsct.exe, to generate a file from an existing .ctc file.
You can use Vsct.exe to generate a .vsct file from an existing .cto file.
You can manually create a new .vsct file.
This topic explains how to manually create a new .vsct file.
To manually create a new .vsct file
Start Visual Studio.
On the File menu, point to New, and then click File.
In the Templates pane, click XML File and then click Open.
On the View menu, click Properties Window to display the properties of the XML file.
In the Properties window, click the Browse (…) button on the Schemas property.
In the list of XSD schemas, select the vsct.xsd schema. If it is not in the list, click Add and then find the file on a local drive. Click OK when you are finished.
In the XML file, type <CommandTable and then press TAB. Close the tag by typing >.
This creates a basic .vsct file.
Fill in the elements of the XML file that you want to add, according to the VSCT Schema. For more information, see Authoring .Vsct Files
Compiling the Code
Simply adding a .vsct file to a project does not cause it to compile. You must incorporate it in the build process.
To add a .vsct file to project compilation
Open your project file in the editor. If the project is loaded, you must unload it first.
Add an ItemGroup element that contains a VSCTCompile element, as shown in the following example.
<ItemGroup> <VSCTCompile Include="TopLevelMenu.vsct"> <ResourceName>Menus.ctmenu</ResourceName> </VSCTCompile> </ItemGroup>
The ResourceName element should always be set to Menus.ctmenu.
If your project contains a .resx file, add an EmbeddedResource element that contains a MergeWithCTO element, as shown in the following example.
<EmbeddedResource Include="VSPackage.resx"> <MergeWithCTO>true</MergeWithCTO> <ManifestResourceName>VSPackage</ManifestResourceName> </EmbeddedResource>
This markup should go inside the ItemGroup element that contains embedded resources.
Open the package file, usually named ProjectNamePackage.cs or ProjectNamePackage.vb, in the editor.
Add a ProvideMenuResource attribute to the package class, as shown in the following example.
[ProvideMenuResource("Menus.ctmenu", 1)]
The first parameter value must match the value of the ResourceName attribute you defined in the project file.
See Also
Tasks
How to: Create a .Vsct File from an Existing .Ctc File
How to: Create a .Vsct File from an Existing .Cto File