Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is an old project name still being referenced in the temp files on Visual Studio

I created and fully baked an MVC C# intranet PROJECT_A. Then I created and fully baked a WebForms C# intranet PROJECT_B.

Now I need to merge the two into a combo MVC/WebForms C# PROJECT_C.

I've done this and it seems to compile.


BUT... when I fire up the new PROJECT_C inside of my VS2013 Ultimate, I get an error on the resultant index page...

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

In the Source Error section is this line that is (obviously) producing the error:

Line 1:    #pragma checksum "C:\...\PROJECT_C\Views\CONTROLLERNAME\Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "56225EBEFF70A747D10FB7D43A7A8EFCE86DAF72"
Line 2:    //------------------------------------------------------------------------------
Line 3:    // <auto-generated>
Line 4:    //     This code was generated by a tool.
Line 5:    //     Runtime Version:4.0.30319.34209
Line 6:    //
Line 7:    //     Changes to this file may cause incorrect behavior and will be lost if
Line 8:    //     the code is regenerated.
Line 9:    // </auto-generated>
Line 10:   //------------------------------------------------------------------------------
Line 11:   
Line 12:   namespace ASP {
Line 13:       using System;
Line 14:       using System.Collections.Generic;
Line 15:       using System.IO;
Line 16:       using System.Linq;
Line 17:       using System.Net;
Line 18:       using System.Web;
Line 19:       using System.Web.Helpers;
Line 20:       using System.Web.Security;
Line 21:       using System.Web.UI;
Line 22:       using System.Web.WebPages;
Line 23:       using System.Web.Mvc;
Line 24:       using System.Web.Mvc.Ajax;
Line 25:       using System.Web.Mvc.Html;
Line 26:       using System.Web.Optimization;
Line 27:       using System.Web.Routing;
Line 28:       using PROJECT_A; //error line...
Line 29:       
Line 30:       
Line 31:       public class _Page_Views_CONTROLLERNAME_Index_cshtml : System.Web.Mvc.WebViewPage<PROJECT_C.Models.Search> {
Line 32:           
Line 33:   #line hidden...

I say "obviously" because PROJECT_A no longer exists in name. There is only PROJECT_C that I'm trying to hammer this round peg into!

The source file that is supposedly producing the error is listed as:

c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\14bee5fc\75cf6bf4\App_Web_index.cshtml.8117ffad.9pjm2azc.0.cs


In an effort to fix this I have done the following:

  1. Cleared %temp% files
  2. Cleared temp files from both c:\Windows\Microsoft.NET\Framework\ and c:\Windows\Microsoft.NET\Framework64\
  3. Searched and replaced all instances of PROJECT_A (and instances of PROJECT_B) with PROJECT_C from within the code
  4. Cleaned project/Solution
  5. Checked namespaces in web.config and elsewhere
  6. ... More that I can't think of

The error persists.


Updated progress:

I've noticed a possible discrepancy with the .net version. My target version is 4.5.1. However, I think that may be in the temp directory name only. You can see it in the source code pasted above. Here's from my web.config

<compilation debug="true" targetFramework="4.5.1">

I've, again, combed through my code looking for errant references to the old project and old classes and can't seem to find any. I've even looked through config.dll s in the bin/. I'm looking for namespace declarations and usings.

For the moment I've excluded the PROJECT_B directory from the main project just to keep it clean.

I really don't want to have to start fresh with a new MVC project as I've already done that. But I may have to.


I've been very careful to include as much information as possible. Let me know if I'm missing anything.

Thank you so much for the help! I'm on day two on this!

like image 566
Jim Nowak Avatar asked Dec 03 '15 20:12

Jim Nowak


1 Answers

One more area to check is web.config file sitting under Views folder, if its excluded by Visual Studio then Find/Replace may not find it.

Change <namespaces> there as well.

like image 164
Syed Tahir Avatar answered Nov 13 '22 10:11

Syed Tahir