0

I have a website, where the *.cs file lies in the App_Code folder (while adding a class item in my project, VS2010 suggested me to create this folder). I have a default.aspx.cs file which makes use of this class. It runs without any error when I run on VS2010.

However, when I deployed the website on the webserver via a private hosting company. It gives me this 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: CS0246: The type or namespace name 'SMSAPP' could not be found (are you missing a using directive or an assembly reference?)

And its pointing to the line of code where I am instantiating the object of the class:

Line 84:         SMSAPP obj = new SMSAPP();

What exactly went wrong from the local version to the hosted version? Please help. Thanks.

What I learned:

Okay, so I haven't been able to run my project yet. But I learned few things which I would like to share- web applications and web sites are totally different things. Mine was a website, that's why the *.cs code's property did not have option to "Build Action" = "Compile". I converted my project from website to web application, and I could see the options being suggested in the answers here. However, no luck in the deployment.

Dev Dreamer
  • 289
  • 1
  • 9
  • 18

4 Answers4

2

Right mouse click on the .cs file and select properties then check if the "Build action" is set to "Compile"

Build action

JohnnBlade
  • 4,261
  • 1
  • 21
  • 22
  • 1
    thanks for your help. But I am not able to see the "Build Action" property for my *.cs file in the App_Code folder. All I am able to see the Misc section with the file name and path. What am I missing? (this project is a web site). And I have deployed using the "Copy Website" feature. Thanks. – Dev Dreamer Jul 12 '12 at 07:06
  • Take these steps: -> Solution explorer window -> right mouse on yr .cs file in visual studio -> select properties -> Build action = compile – JohnnBlade Jul 12 '12 at 07:07
  • 1
    the "Build Action" property is entirely missing. The property window shows nothing but the "Custom Tool", "File Name", and "File Path". Nothing else. Please help. – Dev Dreamer Jul 12 '12 at 07:56
0

Check your local App_Code folder, somewhere there you must have a class SMSAPP.

You must have forgotten to upload this file.

nunespascal
  • 17,584
  • 2
  • 43
  • 46
0

Check property of your *.cs files in App_Code. They should have Build Action as Compile

RredCat
  • 5,259
  • 5
  • 60
  • 100
0

Check in IIS manager if your web app is configured to use the correct .NET version