我創建了一個名爲Foo
的解決方案。 添加了一個名爲Foo.Common
的類庫 添加了一個控制檯應用程序,用於從調用ConsoleApp
調用庫代碼。找不到命名空間!
我從ConsoleApp
引用的Foo.Common
和類型:
using Foo.Common;
public class Program
{
CommonClass c = new CommonClass();
static void Main(string[] args)
{
}
}
,並把它恢復:
Error 1 The type or namespace name '**Foo**' could not be found (are you missing a using directive or an assembly reference?) Z:\Foo\Solution1\ConsoleApplication1\Program.cs 3 11 ConsoleApplication1
爲什麼會出現呢?
發生了什麼事?
是CommonClass聲明爲'public'?如果沒有,則不能在Foo.Common類庫外部使用它。 – dtb
您是否使用Visual Studio?如果是這樣,對象瀏覽器(視圖菜單)將顯示加載的名稱空間。 –
是公開..... –