0
votes

I created a new ASP.NET MVC project and then installed Umbraco 7 via Nuget. As I was just having a play I chose the easy option of using a SQL Server CE database.

I created an empty Umbraco instance and followed a tutorial from the Umbraco site.

Everything was working fine but I ran the solution today and the front end wouldn't display and threw an error

The view found at '~/Views/SimpleContentPage.cshtml' was not created.

I could log into the back end fine however. An example view that no longer worked looked like this:

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.SimpleContentPage>
@using ContentModels = Umbraco.Web.PublishedContentModels;
@{
    Layout = "Master.cshtml";
}

<div id="main-container">
    <div id="main" class="wrapper clearfix">
        <section>
            <h2>@Umbraco.Field("pageTitle")</h2>
            @Umbraco.Field("bodyText")
        </section>  
    </div>
</div>

Once I changed the inherits to just:

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage

It all worked fine. Does anyone know what's gone wrong?

1

1 Answers

1
votes

The ModelsBuilder that converts Document Types into strongly typed Models is likely set to the default "PureLive" mode. This mode means that the models are generated and help in memory at runtime. This also means that Visual Studio will complain about the models not being present.

I would recommend trying either the Dll or AppData modes as they will play nicer with Visual Studio.

For more information about ModelsBuilder, take a look at these posts:

Builder Modes

Get your hands dirty with ModelsBuilder... and your code cleaner