.Net Framework Client Profile 和 .Net Framework

來源:互聯網
上載者:User

.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).
---------------------------
確定  
---------------------------

WPF程式 單獨指向這個檔案的引用, 也是跟上面的情況一樣。也報錯。

上面我碰到的這個問題,只需要簡單的把項目的 Target framework  修改為 .Net Framework 4 就搞定了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.