NET Framework Client Profile是.NET Framework的裁剪版本。它面向客戶端應用程序。它提供 Windows Presentation Foundation (WPF)、Windows 窗體、Windows Communication Foundation (WCF)和 ClickOnce 功能的簡化子集。這可以為面向.NET Framework Client Profile 的 WPF、Windows 窗體、WCF 和控制臺應用程序實現快速部署方案。
參看:http://msdn.microsoft.com/zh-cn/library/cc656912.aspx
在VS2010 中,你默認建立的 WPF 程序就是.Net Framework 4 Client Profile ,而不是.Net Framework 4。昨天下午到今天早上,我在為 System.Web 無法引用而苦惱的問題,就是它導致的。
VS2010中,我們在項目的屬性下,可以看到項目有以下多種 Target framework 屬性。
我今天碰到的 Sytem.Web 引用問題如下:
在用 VS2010 Beta2 書寫一個WPF應用的時候,要使用 System.Web.HttpUtility.UrlEncode()方法時,發現竟然無法增加對 System.Web 的引用。如下圖:
.NET Reference 中沒有 System.Web 組件。
使用 Browse 方式打開指定目錄的文件 C:\Windows\Microsoft.NET\Framework\v4.0.21006\System.Web.dll 也不行。
如下圖:
GAC 中也沒有 4.0 版本的 System.Web 組件,如下圖:
強制添加 C:\Windows\Microsoft.NET\Framework\v4.0.21006\System.Web.dll 到GAC 時會報錯誤:
---------------------------
Cannot Add Assembly
---------------------------
Unable to add the selected assembly. The assembly must have a strong name (name, version and public key).
---------------------------
確定
---------------------------
這個文件的信息如下:
但是VS2010 Beta2 建立的 Web 項目,默認就有 System.Web 的引用,這里沒有任何問題,如下圖:
查看這時候的 System.Web 屬性,如下:
把 C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.dll 放入 GAC也會報錯誤:
---------------------------
Cannot Add Assembly
---------------------------
Unable to add the selected assembly. The assembly must have a strong name (name, version and public key).
---------------------------
確定
---------------------------