0

Ok. In an effort to save time rather than Add => Existing Item I simply compied the view folder from one MVC project to another. Now site will build but not error when I try to view any page.

From compiler full error report:

Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'CopiedFromMVCWebApplication' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 26: using System.Web.Optimization; Line 27: using System.Web.Routing; Line 28: using CopiedFromMVCWebApplication; Line 29: using CopiedToMVCWebApplication;

I thought this was a simple error to fix, did a find for "CopiedFromMVCWebApplication" and found no text with that name. I looked at every file in the view folder I copied into but not reference to the "CopiedFromMVCWebApplication" namespace exists.

I searched online for the error code, but what I found was just fixes to something simple like mispelling the namespace or not referencing but not including a using statement for some assembly.

Notes: Using Visual Studio Pro [Yes, properly licensed], MVC 5, EF 6.

Yuck
  • 49,664
  • 13
  • 105
  • 135
ZombieBunnies
  • 268
  • 2
  • 11
  • Did you miss the web.config that's supposed to be in the View folder root? – Yuck Feb 08 '14 at 01:38
  • I copied it across to the new project, and selected "Replace All" when the dialogue prompted me to overwrite or make a copy. Looking at the web.config now and it looks normal. No references to the old project, but has all the – ZombieBunnies Feb 08 '14 at 01:41
  • Have you copied only VIEWS? Is so can you share view code on which you got error? This error might be because of Models you are using on view s which you copied are not existing or not in the same namespace. Share your code, then we can think so solving your problem , or else we might end up guessing. – ramiramilu Feb 08 '14 at 08:08

1 Answers1

0

You can use compiled views so that you can have compilation error rather than runtime error. refer https://stackoverflow.com/a/15936737/900096 to use compiled view.

Community
  • 1
  • 1