2

Today when I was going to create a partial view I got this error. The partial would contain a form and would be strongly typed with its corresponding model for validation. Although when debugging this through VS2010 I got an error. I checked my log file and saw this error.

c:\Users\projectname\AppData\Local\Temp\Temporary ASP.NET Files\root\ed98b972\6e57e58c\App_Web_index.cshtml.925dc4ed.1cocjzqb.0.cs(31): error CS0234: The type or namespace name 'MailModel' does not exist in the namespace 'Web.NameOfProject.Models' (are you missing an assembly reference?)

At first I thought that I was rendering the partial the wrong way. So I tried both with:

 @Html.Partial("_FeaturedProduct") <---this from my view

and

@Html.RenderPartial("_FeaturedProduct") <--- this from my view

I also tried some other things but none worked. The thing is that here:

@model Web.Project.Models.MailModel <-- it recognizes the model

So that I can acces the fields in my form. Despite this it just won't render. I tried changing to a different model, one that I made yesterday and with that one there is no problem. I also tried removing this model, changing the name and so on but still the problem remains. This is all probably very basic but keep banging my head against the wall with this. Any suggestions?!

Regards!

Note that I have checked all references and namespaces and just can't see that anything is missing.

Tim
  • 531
  • 2
  • 7
  • 25

2 Answers2

3

Clear out your "Temporary ASP.NET Files" folder - looks like it is not getting updated when you are compiling.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • Ok, so I can just remove then all the files residing in that folder?! – Tim Jul 19 '11 at 21:43
  • @Tim - yes. They are regenerated as needed and serve as a cache when there. – Oded Jul 20 '11 at 07:39
  • I tried what you said but the problem remains. I've cleaned the solution rebuild it but without luck. I once more renamed the model to see if that would work but no. This is strange as I've seen other threads where people suggested the same solution as yours. Any other clues?! – Tim Jul 20 '11 at 08:06
  • I believe that I have found the problem. I'm using ActionMailer.NET for my project and I think there is a clash with the getters and setters I'm using in my model. I did not take that into account when constructing the model. Thanks – Tim Jul 20 '11 at 08:27
0

Have you noticed that the error message refers to the namespace:

Web.NameOfProject.Models

But your model is in the

Web.Project.Models

namespace?

Steve Morgan
  • 12,978
  • 2
  • 40
  • 49
  • no sorry it was merely a typo from my part. In my project I am using the same name at both places. – Tim Jul 19 '11 at 21:42