Avatar of Siv
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

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

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!

ASP.NETC#.NET Programming

Avatar of undefined
Last Comment

8/22/2022 - Mon