无论我使用HKEY_LOCAL_MACHINESOFTWAREMicrosoftVisualStudio11.0Projects
中的哪个 ID,它们都不起作用!当我将ShowByDefault
设置为 false
时,"添加新项目"窗口中不会显示任何内容。在我的示例中,我使用 SharePointItemTemplateGroupID
,但Web
也不起作用。我不知道我做错了什么。
我的 *.vs模板:
<?xml version="1.0" encoding="utf-8"?>
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" xmlns:sdk="http://schemas.microsoft.com/developer/vstemplate-sdkextension/2010">
<TemplateData>
<Name>My User Control</Name>
<Description>My User Control with My-specific content.</Description>
<Icon>MyUserControl.ico</Icon>
<TemplateID>b83fe377-e03a-40a8-9366-a04988fae2a7</TemplateID>
<ProjectType>CSharp</ProjectType>
<SortOrder>1</SortOrder>
<RequiredFrameworkVersion>2.0</RequiredFrameworkVersion>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
<DefaultName>MyUserControl.ascx</DefaultName>
<TemplateGroupID>SharePointItemTemplateGroupID</TemplateGroupID>
<ProjectSubType>SharePointItemTemplateGroupID</ProjectSubType>
<ShowByDefault>true</ShowByDefault>
</TemplateData>
<TemplateContent>
<References>
<Reference>
<Assembly>Microsoft.SharePoint</Assembly>
</Reference>
<Reference>
<Assembly>System</Assembly>
</Reference>
<Reference>
<Assembly>System.Web</Assembly>
</Reference>
</References>
<ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.$fileinputextension$">MyUserControl.ascx</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.$fileinputextension$.cs">MyUserControl.ascx.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.$fileinputextension$.designer.cs">MyUserControl.ascx.designer.cs</ProjectItem>
<CustomParameters>
<CustomParameter Name="MappedFolderType" Value="UserControl" />
<CustomParameter Name="$UC$" Value="UserControl" />
<CustomParameter Name="$baseclass$" Value="UserControl"/>
</CustomParameters>
</TemplateContent>
<WizardExtension>
<Assembly>Microsoft.VisualStudio.SharePoint.ProjectExtensions.Wizards, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
<FullClassName>Microsoft.VisualStudio.SharePoint.ProjectExtensions.Wizards.GenericMappedFolderWizard</FullClassName>
</WizardExtension>
</VSTemplate>
注册表项,但是如果您希望项目模板显示在"新建项目"对话框的某个文件夹中,请将其放在文件系统上的相应文件夹中。例如,将压缩的模板文件放在此处:
C:Users<yourusername>DocumentsVisual Studio 2012TemplatesProjectTemplatesCSharpSharePoint
CSharp
文件夹是语言文件夹,因此请替换Visual Basic
或您需要的任何语言。此外,SharePoint
文件夹将不存在于上述路径中,因此您必须创建它。此文件夹的内容与已安装的文件夹合并到:
VisualStudioInstallationDirectoryCommon7IDEProjectTemplates
请参阅MSDN。