命名空間“System.Web.UI”中不存在類型或命名空間名稱“ScriptReference”(是缺少程式集引用嗎?)

來源:互聯網
上載者:User

標籤:blog   http   io   ar   os   使用   sp   檔案   on   

Website從framework 3.5升級到framework4.0編譯的時候報錯:

錯誤 10 命名空間“System.Web.UI”中不存在類型或命名空間名稱“ScriptReference”(是缺少程式集引用嗎?) c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\01.web\582f5aca\78ccecad\App_Web_s2pcmnfi.0.cs 521

在網上找的同一現象的解決辦法:

1. http://www.cnblogs.com/dudu/archive/2010/06/24/1764549.html

2. http://blog.csdn.net/hebingyu/article/details/7765900

發現都不好用,於是只好自己研究了,Aspx的檔案編譯過程是先第一步編譯成cs檔案,第二個再用csc編譯成assembly,根據上面的錯誤尋找編譯的臨時檔案,C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\01.web\582f5aca\78ccecad\s2pcmnfi.out, 開啟後發現csc使用的還是framework2.0的csc,C:\windows\system32> "C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe" /t:library /utf8output /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\01.web\582f5aca\78ccecad\assembly\dl3\5637b46a\4184c99d_6b04d001\ICSharpCode.SharpZipLib.dll" ......

看來原因就是這個了,試著把web.config裡的compilation節點改成<compilation debug="true" targetFramework="4.0">,重新編譯下成功了。

命名空間“System.Web.UI”中不存在類型或命名空間名稱“ScriptReference”(是缺少程式集引用嗎?)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.