publish web website got compilor error CS0433 for master page

N

ningjun.wang

I crate a new asp.net 2.0 web site using Visual Studio 2005. It run
fine in visual studio. I then click Build > Publish Website to build
the dll and copy them to the IIS virtual directory along with all the
..aspx files. I run the application in IIS and got the following error:

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: CS0433: The type 'MasterPage' exists in both
'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\news\408804a4\6fb240fa\assembly\dl3\56c26b89\5255fd02_8e1fc701\App_Web_448itj0s.DLL'
and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\news\408804a4\6fb240fa\assembly\dl3\0e565373\78306203_8e1fc701\App_Web_hkd2czr6.DLL'

Source Error:

Line 110:
Line 111:
[System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 112: public class masterpage_master : global::MasterPage {
Line 113:
Line 114: private System.Web.UI.ITemplate
@__Template_mainContent;


Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET
Files\news\408804a4\6fb240fa\App_Web_masterpage.master.cdcab7d2.nxp-zado.0.cs
Line: 112

Please advise
 
M

Mark Fitzpatrick

You may want to check and verify that you don't have two dlls that have the
definition for this class. That's one of the problems with using the web
site project, it compiles the files in a directory as needed and assigned
them some number to make them unique. Unfortunately, this will leave you
with two different dlls that contain the same exact namespace references,
which is probably what this is telling you about. This means you have to
ensure you delete the old dlls first. You may want to try the new Web
Application Project which is downloadable over at www.asp.net. It
precompiles the site into a single dll in the same fashion that VS 2003 did.
 
N

ningjun.wang

Thanks for the help. I found the problem. I have backed up my
MasterPage.master as MasterPage_backup.master long time ago. As a
result, both files got compiled and they define exactly the same class.
I used to use Visual C++ 6.0 and it will generate a compilation error
when two source files define the same class. Visual Studio 2005 should
do a better hob to detecdt such error during compilation.
 
J

Juan T. Llibre

re:
Visual Studio 2005 should do a better hob to detecdt such error during compilation

Or, you could simply rename your backup files with the .bak extension.
That would solve the problem, too.

MasterPage.master.bak won't be compiled.

I often have *two* backup files for different versions.
I rename the older backup *.old. ( MasterPage.master.old , in this case ).

That way, I have references to previous configurations, while avoiding compilation errors.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top