2011-05-26 96 views

回答

3

一些挖掘後和「反映」,我得到了一個模板,成功地顯示出來在對話框中。大部分的功勞去這個職位:Add custom viewengine to New project dialog?

讓我的機器(64位)工作的關鍵是在該帖子的答案中提到的註冊表路徑。如果您需要,我還通過Reflector找到了SupportsHTML5密鑰。

這裏是我的模板的屏幕截圖: enter image description here

,這裏是註冊表項(也有在MyOwnTemplate節點的標題和描述)

enter image description here

+0

這是一個很好的答案!它很簡單,一旦你找到它:) – Beno 2011-06-01 01:40:51

+0

Thnx傑森。這正是我想要的。現在剩下要做的唯一事情是以某種方式自動執行此過程:修改註冊表項並將.zip(模板)複製到Project Templates文件夾中。 – 2011-06-01 18:40:57

+0

不要忘了你需要運行devenv.exe/setup來將你的模板放到VS的Project Template Cache中。 – 2011-06-01 19:31:25

2

如果你看看你的模板目錄的Visual Studio,並檢查了模板:

MvcWebApplicationProjectTemplatev3.0.cs.zip

(VS安裝目錄)\ Common7 \ IDE \ ProjectTemplates \ CSHARP \網絡\ 1033

看這裏的東西是這一行:

<WizardExtension> 
    <Assembly>Microsoft.VisualStudio.Web.Mvc.3.0, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</Assembly> 
    <FullClassName>Microsoft.VisualStudio.Web.Mvc.UserInterface.MvcTemplateWizard</FullClassName> 
</WizardExtension> 

所以他們有一個自定義嚮導在這裏工作。 這些問題看起來是相似的:
Blank Asp.net MVC template
How to write an MVC3 Project Template that will offer option Razor or .aspx views

基本上,他們說精靈是不是開源的,但你可能會寫自己的自定義嚮導。

編輯:
這裏有幾個頁面,告訴你如何創建自己的嚮導:
http://msdn.microsoft.com/en-us/library/ms185301.aspx
http://www.codeproject.com/KB/system/create_VS_wizard.aspx

+1

如果你使用反射,你可能想看看這些方法:代碼://Microsoft.VisualStudio.Web.Mvc.3.01:3.1.0.0:31bf3856ad364e35/Microsoft.VisualStudio.Web.Mvc。 UserInterface.ProjectTemplates/LoadProjectTemplate(Microsoft.Win32.RegistryKey,字符串,字符串):Microsoft.VisualStudio.Web.Mvc.UserInterface.ProjectTemplate – 2011-06-01 01:35:01

+0

和代碼://Microsoft.VisualStudio.Web.Mvc.3.01:3.1.0.0:31bf3856ad364e35/Microsoft.VisualStudio.Web.Mvc.UserInterface.ProjectTemplates/LoadProjectTemplates(系統。的IServiceProvider,字符串,System.Collections.Generic.Dictionary <字符串,Microsoft.VisualStudio.Web.Mvc.UserInterface.ProjectTemplate>):System.Collections.Generic.Dictionary <字符串,Microsoft.VisualStudio.Web.Mvc.UserInterface.ProjectTemplate> – 2011-06-01 01:35:18

相關問題