Reputation: 289
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.
Upvotes: 0
Views: 7588
Reputation: 1
Check in IIS manager if your web app is configured to use the correct .NET version
Upvotes: 0
Reputation: 5431
Check property of your *.cs files in App_Code. They should have Build Action
as Compile
Upvotes: 0
Reputation: 17724
Check your local App_Code folder, somewhere there you must have a class SMSAPP
.
You must have forgotten to upload this file.
Upvotes: 0
Reputation: 4327
Right mouse click on the .cs file and select properties then check if the "Build action"
is set to "Compile"
Upvotes: 2