2015-06-24 50 views
0

我正在使用NetOffice開發Outlook插件。這個插件正在我的本地機器上工作,當通過Visual Studio(以某種方式神奇地)部署時(如果我運行該項目,然後打開Outlook的功能在那裏)。一切都好,直到這裏。但是,我需要將它部署到其他人的計算機上(沒有安裝VS),我正在努力尋找如何實現這一點的方法。NetOffice Outlook插件部署

我的插件看起來像這樣:

[COMAddin(Constants.ProjectName, "Tool", 3)] 
[Guid("B3F60319-1A11-4F3E-9C1B-3AE908D9CA86"), ProgId("Tool.OutlookIntegration")] 
public class OutlookIntegration : COMAddin 
{ 
    public OutlookIntegration() 
    { 
     this.OnStartupComplete += new OnStartupCompleteEventHandler(this.Integrate); 

     _settings = new Settings(); 
    } 

    /* Integrate creates a menu item which does what I need. */ 
} 

的項目類型是圖書館。現在,問題是我該如何讓別人在PC上運行?如果你碰巧知道一些教程或類似的東西,請告訴我。互聯網上有資源開發Outlook插件,但它們對於NetOffice來說似乎不同。 NetOffice本身有很好的開發文檔,但不適合部署(至少我沒有發現它)。

我也很樂意提供任何需要的額外細節。

回答

0

使用什麼庫來開發Office加載項並不重要。所有COM加載項的部署過程都是相同的。請參閱MSDN中的Deploying an Office Solution部分。

2

爲了展望安裝一個插件,你要做的唯一事情就是在註冊表全部

string runKey = "SOFTWARE\\Microsoft\\Office\\Outlook\\Addins"; 
RegistryKey startupKey = Registry.CurrentUser.OpenSubKey(runKey, true); 
if (startupKey != null) 
{ 
    runKey="SOFTWARE\\Microsoft\\Office\\Outlook\\Addins\\yourAddinNameSpace.yourAddinClass"; 
    startupKey = Registry.CurrentUser.OpenSubKey(runKey, true); 
    if (startupKey == null) 
    startupKey = Registry.CurrentUser.CreateSubKey(runKey); 
    startupKey.SetValue("Description", "yourAddinName", Microsoft.Win32.RegistryValueKind.String); 
    startupKey.SetValue("FriendlyName", "yourAddinName", Microsoft.Win32.RegistryValueKind.String); 
    startupKey.SetValue("LoadBehavior", 3, Microsoft.Win32.RegistryValueKind.DWord); 
    } 
} 
else 
    Console.WriteLine("Outlook is not installed"); 
添加一些記錄