Solved

C# .NET 2013 can't find Class

Posted on 2015-01-22
6
205 Views
Last Modified: 2015-01-29
I am migrating a website (.NET 2008) to a web application (.NET 2013).  I am having an issue where I have a class in the App_Code folder that used all over the place and now it can't find it.  I believe it is because of the new structure folder structure.

I created the web app in .NET 2013 then copied the website to the directory in the 2013 directory and included the files per instructions I found on the web.

As an example of the current directory structure in Solution Explorer.

MyNewApp(1)
- MyNewApp
  -  App_Code
     - AppClass.cs

using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections;
using System.Diagnostics;
using System.Data;
using System.Data.SqlClient;

namespace PremiumAdmin
{
	public class AppClass : System.ComponentModel.Component
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		protected string sConnectionString;
		protected short iUserID;
		protected string sLastError;

Open in new window



using System;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI.WebControls;
using PremiumAdmin;  //Having issues resolving here

public partial class baseFrame : System.Web.UI.MasterPage
{
    protected AppClass appClass = (AppClass)HttpContext.Current.Session["appClass"];  //Having issues resolving here
    public delegate void attachDocumentDelegate(int iDoc);
    public attachDocumentDelegate attachDocument;

    protected void Page_Load(object sender, System.EventArgs e)
    {
        pnlHeaderMenu.Visible = true;
    }

Open in new window


Error I'm receiving now.
The type or namespace name 'AppClass' could not be found (are you missing a using directive or an assembly reference?)      

ANy ideas how to resolve?
0
Comment
Question by:CipherIS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 9

Expert Comment

by:Seven price
ID: 40565257
Not really. that is a big jump. most applications if you are using 2013 have to be upgraded to at least 4.0.  Its best to create a new application and move over the files one by one. if it was 2010 to 2013 the migration would of been much easier.  Sorry.
0
 
LVL 9

Expert Comment

by:Seven price
ID: 40565265
Try this PremiumAdmin.Appclass
protected AppClass appClass = (PremiumAdmin.AppClass)
0
 
LVL 82

Expert Comment

by:David Johnson, CD, MVP
ID: 40565352
in the project references add a reference to your class
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 9

Expert Comment

by:Seven price
ID: 40565365
that was to simple David Johnson. that could be the case but not most classes mostly only a dll not a class.
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 40565547
Generally speaking, App_Code isn't used in Web Application projects. Are you intending on having dynamic compilation in your Web Application, or do you simply want to compile the code like you normally would in a Web Application? If it's the latter, then make sure the Build Action of your .cs files is set to "Compile".
0
 
LVL 1

Author Closing Comment

by:CipherIS
ID: 40578287
That was it.  Setting it to Compile resolved it.  Thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question