tags:

views:

33

answers:

2

after uploading my project to server i am getting following error please let me know what is the following error

CS0433: The type 'Course' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\672b2bdf\9fb2ad98\assembly\dl3\afaf3b67\f1871969_3e5bcb01\App_Code.DLL' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\672b2bdf\9fb2ad98\assembly\dl3\29fd4e0e\f1751c7e_3e5bcb01\App_Web_spb4jssk.DLL'

and

Line 111:    [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 112:    public class admin_course_aspx : global::Course, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler {
Line 113:        
Line 114:    private static bool @__initialized

and

Source File:  c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\672b2bdf\9fb2ad98\App_Web_course.aspx.fdf7a39c.gdurkajz.0.cs
Line: 112
A: 

I would also recommend what Claudio says. However, you may want to double check that you don't have any source files in the App_Code directory that were erased in your local copy (as they were moved into a different DLL)

Jason Kealey
+1  A: 

It looks like you may have a Web Site, and not a Web Application Project.

For a Web Site, you get a lot of arbitrarily named .DLLs, such as your "App_Web_spb4jssk.DLL" above. These names are different every time you compile.

What's probably happening is that when you add your new dlls to your production server, the old one (with a different name) is still there, and contains the same class names as your new ones.

What you have to do is delete everything in the bin directory of your production server before you upload your new ones.

Ideally, what you should do is convert your web site to a Web Application Project.


Update:

Here is an article that describes how to convert a website into a web application project. It's specific to VS2005, but the steps are basically the same for VS2008 and VS2010.

The difference between a website and a web application project is that in a web application there is a project file that keeps track of all the files and settings for your website, just like for any other Visual Studio project. A web application will also compile your entire site into just one dll.

If you have a web site that doesn't have a project file, it doesn't explicitly know how you want to compile your website, so it ends up creating a bunch of separate dll files with random names.

AaronS
how can i convert my web site to web application project and whats the difference between the and what are the advantages of doing this?
NoviceToDotNet
Updated my response with answers to your questions.
AaronS
i have deleted all my data from the sever and re updated the published project but of no avail, i am getting the same error
NoviceToDotNet
You may need to also delete all of the JIT files as well. These can be found here: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files Delete all of the files and folders in that folder.
AaronS