|
 |
 |
 |
 |
Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms
of Use |
Trademarks
Article ID: 833268 - Last Review: April 29, 2007 - Revision: 1.5 You receive a "Compiler Error Message: CS1595" error message when you use the Src attribute in an ASP.NET applicationWhen 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. When 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. To 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.
This
behavior is by design. Steps to reproduce the behavior
- Start Visual Studio .NET.
- On the File menu, point to
New, and then click Project. The New
Project dialog box appears.
- Under Project Types, click Visual
C# Projects, and under Templates, click ASP.NET Web
Application.
- In the Location box, type
http://YourServerName/MyWebApp,
and then click OK. By default, a form that is named WebForm1 form is created.
- Add a Literal control to
the WebForm1 form.
- In Solution Explorer, right-click
WebForm1.aspx, and then click View
Code.
- Add the following code to the Page_Load
procedure:
Literal1.Text = "This is a test page"; - On the Build menu, click Build
Solution.
- On the Debug menu, click
Start. The WebForm1.aspx page appears.
- Close the WebForm1.aspx page.
- In Solution Explorer, right-click
WebForm1.aspx, and then click View Designer.
- Switch to the HTML view of
the WebForm1 form.
- In the HTML view of the WebForm1 form, locate
the following code:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="MyWebApp.WebForm1" %> - Replace the code that was located in step 13 with the following
code:
<%@ Page language="c#" Src="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="MyWebApp.WebForm1" %> - On the Build menu, click Build
Solution.
- On the Debug menu, click
Start. You receive the error that is mentioned in the
"Symptoms" section.
For more information, visit the following Microsoft
Developer Network (MSDN) Web site:
APPLIES TO- Microsoft ASP.NET 1.1
- Microsoft ASP.NET 1.0
- Microsoft Visual C# .NET 2003 Standard Edition
- Microsoft Visual C# .NET 2002 Standard Edition
| kberrmsg kbdll kbcompiler kbwebforms kbwebbrowser kbprb KB833268 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
|
Ian Gooding
- iang NOSPAM-AT-NOSPAM scriptureunion.org.uk
|
Reported as Irrelevant
|
| Written:
5/28/2004 4:29 AM |
|
|
|
Alex Szeremeta
- alexszeremeta NOSPAM-AT-NOSPAM hotmail.com
|
Report As Irrelevant
|
| Written:
3/4/2005 6:13 AM |
|
|
|
muthkats
- amkumaran NOSPAM-AT-NOSPAM rediffmail.com
|
Report As Irrelevant
|
| Written:
1/11/2006 1:04 AM |
|
|
|
 |
 |
 |
 |
 |
 |
 |
| |