2015-03-31 115 views
0

我正在嘗試向已在運行的應用程序添加狀態欄。我正在使用Visual Studio 13,WPF,C#。Visual Studio 2013 C#無法找到類型或名稱空間名稱IVSStatusBar

public void SetStatusBar(string text) { IVsStatusbar statusBar = (IVsStatusbar)GetService(typeof(SVsStatusbar)); }

我得到這些錯誤: 類型或命名空間名稱「IVsStatusbar」找不到(?是否缺少using指令或程序集引用) 「GetService的」名稱不存在當前上下文 和第一條消息'SVsStatusbar'

我有最新的SDK。我的使用陳述是:

using System 
using System.IO; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Data; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Imaging; 
using System.Windows.Navigation; 
using System.Windows.Shapes; 
using GemBox.Spreadsheet; 

我在想什麼?這不應該很難找到。

+0

你可能缺少參考Microsoft.VisualStudio.Shell.Interop。 – Ulric 2015-03-31 17:56:58

+1

'IVSStatusBar'是在命名空間Microsoft.VisualStudio.Shell.Interop中定義的[接口](https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsstatusbar.aspx) '在程序集'Microsoft.VisualStudio.Shell.Interop.dll'中。 1)我在你的使用指令中看不到這個命名空間2)包含它的程序集在標準中懷疑地被[默認引用](https://msdn.microsoft.com/en-us/library/wkze6zky.aspx) WPF項目模板。 – 2015-03-31 17:57:17

+1

一些額外的信息在這裏:http://stackoverflow.com/questions/16678056/how-to-implement-ivsstatusbar-when-making-a-visual-studio-add-in – Ulric 2015-03-31 17:58:32

回答

0

您需要使用Microsoft.VisualStudio.Shell.Interop

MSDN article應提供任何可能需要的更多信息。

+0

我已經嘗試過,我發佈之前。對不起,我應該提到它。當我輸入使用和Microsoft時,VisualStudio沒有智能感知。我無法通過使用添加。我重新下載了SDK,但它仍然沒有顯示出來。 – 2015-04-01 19:32:01

+1

好的,我明白了。我需要點擊引用,添加引用,選擇擴展並將其添加到那裏。然後,我可以用'使用'來聲明它。 – 2015-04-01 19:46:30

0

IVsStatusBar定義在Microsoft.VisualStudio.Shell.Interop.dll添加此名稱空間。

請參閱本頁面How to implement IVsStatusbar when making a Visual Studio Add-In

+0

我最初使用那個頁面。我沒有Microsoft.VisualStudio.Shell.Interop。我無法在微軟的網站上找到如何安裝這個組件。 – 2015-04-01 19:33:44

+1

你的意思是你找不到。您需要爲項目添加(Interop.dll)引用並將其添加到代碼中的命名空間 – user2526236 2015-04-01 19:36:27

相關問題