You receive a "Compiler Error Message: CS1595" error message when you use the Src attribute in an ASP.NET application (833268)
The information in this article applies to:
- Microsoft ASP.NET (included with the .NET Framework 1.1)
- Microsoft ASP.NET (included with the .NET Framework) 1.0
- Microsoft Visual C# .NET (2003)
- Microsoft Visual C# .NET (2002)
SYMPTOMSWhen you compile your Microsoft ASP.NET application in Microsoft
Visual Studio .NET and then you try to apply the Compile on Demand approach by
using the Src attribute to reference the code-behind class file, you receive
the following compiler error message when you view the Web page in the ASP.NET application in your Web browser: Compiler Error Message: CS1595: 'MyWebApp.WebForm1' is
defined in multiple places; using definition from
'%windir%:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\mywebapp\877759ce\3fb79741\assembly\dl2\6a29f2d8\00f82a8d_5c32c401\MyWebApp.DLL'
Note MyWebApp is a placeholder for
the name of your project. CAUSEWhen you compile your ASP.NET
application by using Visual Studio .NET, the code-behind file is compiled and
the MyWebApp .dll file is created in the Bin
folder. However, when you use the Src attribute, the code-behind file is again compiled on demand or Just In Time (JIT)-compiled. This behavior creates two
assemblies with the same type definition. Therefore, you receive the compiler
error message that is mentioned in the "Symptoms" section.RESOLUTIONTo resolve this problem, you must delete the Global.asax file and the MyWebApp.dll file
from your project, and then
open the page in Microsoft Internet Explorer. To do this, follow these steps:
- In Visual Studio .NET, click Show
All Files on the Project menu.
- In Solution Explorer, expand bin.
Right-click MyWebApp.dll, and then click
Delete.
- In the Microsoft Development Environment
dialog box, click OK.
- In Solution Explorer, right-click
Global.asax, and then click
Delete.
- In the Microsoft Development Environment
dialog box, click OK.
- On the File menu, click Save
All to save the Web Form and other associated project files.
- Start Internet Explorer.
- In the Address box, type
http://yourservername/MyWebApp/WebForm1.aspx,
and then press ENTER. The WebForm1.aspx page opens.
STATUS This
behavior is by design.REFERENCESFor more information, visit the following Microsoft
Developer Network (MSDN) Web site:
Modification Type: | Major | Last Reviewed: | 5/20/2004 |
---|
Keywords: | kberrmsg kbDLL kbCompiler kbWebForms kbWebBrowser kbprb KB833268 kbAudDeveloper |
---|
|