Link to home
Start Free TrialLog in
Avatar of feesu
feesu

asked on

ASP.Net | Compiling an Old Project in ASP.Net 2013

Hello ASP.Net guys,

I had not been programming for few years, and the code I have for my portal was developed in an older version of ASP.Net
I have opened my project with ASP.Net 2013 and got 102 errors, one of them is this:

User generated image
Why can’t I instantiate a code class anymore?
The class DB_Survey is defined in the App_Code folder as the following:

User generated image
Any idea?

Thank you,
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

If you project is not building due to errors, then you may not be able to instantiate that class as Visual Studio doesn’t think it is valid.  With 102 errors, my gut is your project is targeting a newer version of .NET or some package that deprecates some of the code you are using but that’s just a guess without seeing the actual error messages.
First off is to look where you have the class DB_Survey defined in your project, I assume it is a class you have coded yourself.  (Find in files is your friend here).  This error looks like you are missing some files in the project.
Avatar of feesu
feesu

ASKER

@Kevin: The project has errors that I am unable to fix because I don't know what the hell is wrong. If I don't code for 3-4 years that's what happens? I am lost and confused. I started by the first error in my list, but you are now saying that this error shows because other errors exist! I don't know where to start!

@Andy: I mentioned in my question that the class is inside the app_code and used to always work! This same project without changing anything used to work on this same laptop but with the old version of ASP.Net and Telerik controls.

Thank you guys for writing back!
Perform a clean and rebuild.  That might help.
I would also confirm that the file containing this class really does exist and is included in your project.  

I believe you that it did work BUT you also say it is not compiling anymore.  Check, do not assume it is still OK because it was OK some years ago.  You will save yourself a lot of time and effort and nerves should you find a folder has been renamed or a file not copied at some time since it last worked.
try letting vs create the missing class.  then copy /paste your code to that zone if necessary.

do you have CS  & VB folders below App_Code ?

here is my web.config
 <system.web>

    <authentication mode="Windows"/>
    <compilation targetFramework="4.5" debug="true">
      <codeSubDirectories>
        <add directoryName="VBCode"/>
        <add directoryName="CSCode"/>
      </codeSubDirectories>
      <assemblies>
        <add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
      </assemblies>
    </compilation>

  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>

Open in new window

Avatar of feesu

ASKER

@Andy: I confirm the same folder was not edited or touched at all. It used to work with my .NET previous version. Now it does not compile.

The same project still works as a live version for one of the companies until this moment.

Clean shows me:
------ Clean started: Project: VERA, Configuration: Debug Any CPU ------
========== Clean: 1 succeeded, 0 failed, 0 skipped ==========

However, build still shows me the 102 errors.

@Robr: I have 100s of classes, if this going to be repeated to all (paste the code to all), then it is not practical.

No, the app_code folder has the folders of classes and then the code files:

User generated image
Are you using namespaces?
Avatar of feesu

ASKER

I do when needed. Why?
Forget it - I have just looked at your question's code again and seen there isn't one wrapping the DB_Survey class.
Avatar of feesu

ASKER

What do you suggest? I am lost!
try the option to create the class once.  see if it fixes the 1st item.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.