昨天寫了一個很小的winform程序,其中引用了自己寫的兩個dll文件。
本來認爲輕鬆搞定,結果一編譯居然提示:未能找到類型或命名空間名稱。。。。。
於是刪掉兩個dll重新引用,再編譯結果依舊!很是鬱悶。
後來經過調查,終於發現瞭解決方法:
在項目上點右鍵-->屬性-->應用程序-->目標框架-->修改爲.NET Framework 4。
而我原來的設置是.NET Framework 4 Client Profile。問題就出在這裏。
以下是MSDN給出的提示:
If you are targeting the .NET Framework 4 Client Profile, you cannot reference an assembly that is not in the .NET Framework 4 Client Profile. Instead you must target the .NET Framework 4.
MSDN:http://msdn.microsoft.com/en-us/library/cc656912.aspx