We help IT Professionals succeed at work.
Get Started

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

Siv asked
Last Modified: 2016-08-22
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);

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!

Watch Question
Senior Web Developer
This problem has been solved!
Unlock 1 Answer and 15 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE