1

When I launch the website locally it works fine, however when I upload this to the server I get "The type or namespace name 'type/namespace' could not be found.." for my App_Code folder

my ".aspx.cs" class

using XXXXXX.App_Code;

Any clues as to why?

Mike Bryant
  • 2,455
  • 9
  • 39
  • 60

3 Answers3

6

You want to change whatever inside App_Code folder to Compile.

enter image description here

Win
  • 61,100
  • 13
  • 102
  • 181
  • I don't have this option, I only have, File Name, Custom Tool and full path name – Mike Bryant Apr 03 '13 at 14:49
  • Please make sure you click on a Class. If still doesn't work, please post a screenshot of `Solution Explorer ` (expend all items). – Win Apr 03 '13 at 15:00
  • Is there a reason not to use `ASP.Net Web Forms Application` under `File > New > Project > Templates > Visual C# > Web > ASP.Net Web Forms Application`? – Win Apr 03 '13 at 15:21
  • Not really, I imported an existing website, visual studio chose the "website" type for me – Mike Bryant Apr 03 '13 at 15:23
  • You are using `Web Site Projects`. Here is the differences - http://msdn.microsoft.com/en-us/library/dd547590.aspx – Win Apr 03 '13 at 15:37
  • I don't know why Visual Studio convert to Web Site Project automatically. If your application doesn't have a lot of pages, I prefer creating a new `Web Application Project/Web Forms Application` and copy old codes to new one manually. – Win Apr 03 '13 at 15:39
  • haha thanks, I just saw your answer as I finished to converting it manually with good old ctrl + c, ctrl + v lol nevermind it didn't take me long, now to test it out on the real server, wish me luxk! – Mike Bryant Apr 03 '13 at 15:57
1

You may be uploading to the server which doesn't have the correct version of .NET or the correct framework. I've had this issue updating my MVC3 website to a server which doesn't have MVC3 installed.

Make sure the Application Pool in IIS is referencing the correct version and that the server has the relevant framework(s) installed.

Also, in Visual Studio, under Items to deploy, make sure All files in this project folder are selected and that Exclude files from the App_Data folder is not checked.


If you built your site as a project (ie, not a website)

Right click on the Solution -> Configuration Manager and check that it exists for Release and is checked to Build


If you built your website as a new website (ie, not via new project)

Right click on the solution and select Property Pages. Make sure the file is added under References. Make sure under Build, Build website before running is selected

Dave
  • 8,163
  • 11
  • 67
  • 103
  • @MikeBryant OK, sorry for confusing you. Within your website, right click on Solution and selection and select Property Pages. Make sure, under references, your file is there. And check that the website is set to build before running (under build) – Dave Apr 03 '13 at 15:02
0

Create a \bin folder under your website and copy dlls you reference there.

B H
  • 1,730
  • 18
  • 24