troubleshooting Question

Visual Studio 2015 - Had to load an existing ASP.NET c# project into a new solution now getting CS0103 errors all over the place.

Avatar of Siv
SivFlag for United Kingdom of Great Britain and Northern Ireland asked on
ASP.NETC#.NET Programming
15 Comments1 Solution770 ViewsLast Modified:
Hi,
I had a web project that compiled without issue. Strangely that project didn't have a solution file. I then had to do a clean install of my PC and as part of the tidying up process after that I decided to have a tidy up and rebuild this project but this time I wanted to have a solution file.

I copied the old project to a temporary folder and then created a new empty web solution with exactly the same name and in the same folder.  I then imported the files I wanted to keep back into the new project using the "Add existing item.. " method.  I had all the files I wanted and the project was all set to go. I added back the same references and added all the ASP folders like APP_Code and App_Data as well as custom folders like "font", "images", "css" and "js".

Everything looked as it did in the original project so I tried to compile it and when I did I get masses of CS0103 errors.  The initial ones all relate to classes in my App_Code.  I have a class called "Common" that I use to keep common routines in.  Everywhere in my code where I have put something like this:

            Common.DBFilePath = Server.MapPath("App_Data\\Kohola.mdb");
            paramCN = new OleDbConnection(Common.DefCon + Common.DBFilePath);
            paramCN.Open();

The emboldened items are underlined as an error and there is a corresponding CS0103 error saying:


The name 'Common' does not exist in the current context      Dashboard

Well it does and it's in my APP_Code folder, the Common Class has this at the top of it:

using System;

namespace Dashboard
{
    public static class Common
    {
        ..... various functions that I use all over the place.
    }
}

Where am I going wrong? How do I get the project to recognise that wherever I use common I am referring to my Common Class that is within the same project?

Any help appreciated, this is driving me nuts!

Siv
ASKER CERTIFIED SOLUTION
Dustin Hopkins
Senior Web Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros