Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing namespace names in MVC 3 applications causes compilation errors in generated files at runtime

I just started a new project and was reorganizing the source structure including renaming namespaces. After changing a namespace from

CRTReadmissions.Web.Helpers

to

Crt.Readmissions.Web.Helpers

I get the error shown below when trying to launch the applicaiton indicating that it can't find the old namespace. Any help is greatly appreciated.

Things I've tried

  1. Clean\Rebuild
  2. Manually delete bin directory
  3. Manually delete the contents of the directory where the generated file is located

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 'CRTReadmissions' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 26:     using System.Web.Routing;
Line 27:     using Cassette.Views;
Line 28:     using CRTReadmissions.Web.Constants;
Line 29:     using CRTReadmissions.Web.Helpers;
Line 30:     

Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\crtreadmission\203bedd5\1b724153\App_Web_login.cshtml.3f4b83a6.wbzlumh4.0.cs Line: 28

like image 748
Ryan Vice Avatar asked Apr 20 '12 18:04

Ryan Vice


1 Answers

I solved the same problem by editing the web.config file in the Views folder. Just take a look at the namespaces tag. I hope this will help someone who faces the same issue.

like image 96
Stofkn Avatar answered Oct 17 '22 16:10

Stofkn