Cannot load type (加载页面出错)

 

在VS 2005中碰到如下问题:
The following error occurs when lauching a page  after conversion. The project is building correctly

We have cleared the Temporay Asp.NET  files and Bin directory and rebuilt the probject with the same results.  

 

Server Error in '/NewPort' Application.

--------------------------------------------------------------------------------

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The type 'NewPort.Global' is ambiguous: it could come from assembly 'c:\inetpub\wwwroot\NewPort\bin\NewPort.DLL' or from assembly 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\NewPort\07690470\8276eef8\App_Code.xh-j8gvn.DLL'. Please specify the assembly explicitly in the type name.

Source Error:

Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="NewPort.Global" %>

Source File: /NewPort/global.asax Line: 1

原因是:App_Code目录中的*.cs文件没有被编译到Assembly中去。

解决方法是:重命名App_Code目录(在VS中不能重命名该目录,可直接重命名硬盘目录)或将*.cs文件移到别的目录中去。这只是实践经验总结,是否有其他更好的方法不得而知。

你可能感兴趣的:(load)