iT邦幫忙

2017 iT 邦幫忙鐵人賽
DAY 14
0
自我挑戰組

全端工程師的日常挑戰三十日系列 第 14

如何發行 Visual Studio 專案範本(project Template)

  • 分享至 

  • twitterImage
  •  

如何發行 Visual Studio 專案範本(project Template)

最近在看 Microsoft Bot Framework, 官網上的 Startup 請大家下載一個 zip 放到指定的目錄(vs2015 放在 Documents\Visual Studio 2015\Templates\ProjectTemplates\Visual C#),接著就可以在 Visual Studio 上出現專案範本了。雖然滿容易的,還是覺得也許有更好的方式。

準備 Project Template

這邊就使用 Bot Framework Downloads 當做範例

建立 VSIX 專案

  1. File --> New --> Project...

    newproject

  2. Templates --> Visual C# --> Extensibility --> VSIX

    addvsix

  3. 將從Microsoft Bot Framework 上下載回來的 Bot Application.zip 加入專案

    addzip

  4. Bot Application.zipCopy to Output Directory 屬性改為 Copy always

    copyalways

  5. 編輯 source.extension.vsixmanifest(Metadata)

    依序填入

    • 5-1. Product Name
    • 5-2. Product ID
    • 5-3. Author
    • 5-4. Version
    • 5-5. Description

      manifest

  6. 新增 source.extension.vsixmanifest(Assets)

  • 6-1. Assets --> New

    assetsnew

  • 6-2. 選擇 Type,Source,Path

    1. Type : Microsoft.VisualStudio.ProjectTemplate
    2. Source : File on filesystem
    3. Path : 選擇 Bot Application.zip

    assetsdone

  1. Build project
    在專案檔案位置的bin資料夾會產出 .vsix檔 ,即可用來安裝

發行至 Visual Studio Marketplace

  • 開始發行

    upload

  1. 選擇擴充功能類型--> 專案或文章範本

    extendtype

  2. 上傳檔案

    uploadfile

  3. 填寫基本資料

  • 描述要超過 280 字,記得同意投稿協議

    basicinfo

  1. 預覽

    readttopublish

  2. publish

    published

測試

  1. 套件管理員

    extensionmanager

  2. Visual Studio Gallery 搜尋 bot

    searchbot

  3. 新專案 --> 搜尋已安裝專案範本--> Bot Application

    bottemplate

  4. 成功產生 bot application 專案

    PROJECTOK

優缺點

優點:用 VSIX(擴充套件) 來新增,不需額外下載及記憶 template 位置,方便大家使用.
缺點:不像自行丟檔,可以有明顯的 template 位置,必需透過搜尋,新增時比較好找.

用 VSIX 不會出現下圖 Bot applications 的分類(這個可能是我設定上的問題)
templatefolder

參考資料

  1. Microsoft Bot Framework
  2. Bot Framework Downloads
  3. Getting Started with the VSIX Project Template
  4. Visual Studio Marketplace

上一篇
如何 Debug 在 Release Mode(Release Build) 產生的網站
下一篇
LINQPad 設定需驗證代理伺服器(proxy with authentication)
系列文
全端工程師的日常挑戰三十日31
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言