Umbraco: "System.InvalidOperationException: The view found at '~/Views/Homepage.cshtml' was not created."
Asked Answered
C

2

6

This is my first post in this stackoverflow. I hope to do it correctly.

I spend hours look for a solution without results. I'm using Umbraco version 7.5.7 assembly: 1.0.6219.11990

I use Visual Studio Express 2015 For Web, if I run the project with debugger (f5), I have no problem and my developed site works perfectly. If I run the project without debugger (ctrl+f5) nothing works

run with or without debugger buttons

This is the exception thrown:

System.InvalidOperationException: The view found at '~/Views/Homepage.cshtml' was not created.

I had the same issue in all pages that I create but I'm able to enter in Umbraco settings pages correctly in any mode.

Any ideas?

error's screenshot

[EDIT] Included code of master (layout) and homepage but I have the same problem in all pages

Here's the "master" code:

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using Umbraco.RelationEditor.Extensions;
@using Comp.Umb.Lisa.Models;
@using Comp.Umb.Lisa
@{
    Layout = null;
}

@Html.Partial(LisaContansts.Partials.MetaData)

<link rel="icon" href="~/images/favicon.ico" type="image/x-icon">
<link href="~/css/common.css" rel="stylesheet" />
<link rel="stylesheet" href="~/css/grid.css">
<link rel="stylesheet" href="~/css/style.css">
<link rel="stylesheet" href="~/css/camera.css">
<link rel="stylesheet" href="~/css/search.css">
<link rel="stylesheet" href="~/css/google-map.css">
<link rel="stylesheet" href="~/css/jquery.fancybox.css">
<link rel="stylesheet" href="~/css/subsribe_mailform.css">

<link rel="stylesheet" href="~/css/blocks.css">
<link href="~/css/header.css" rel="stylesheet" type="text/css" />
<script src="~/js/jquery.js"></script>
<script src="~/js/jquery-migrate-1.2.1.js"></script>
<script>
    <!-- analytics -->
</script>
<!--[if lt IE 9]>
<html class="lt-ie9">
<div style=' clear: both; text-align:center; position: relative;'>
  <a href="http://windows.microsoft.com/en-US/internet-explorer/..">
    <img src="images/ie8-panel/warning_bar_0000_us.jpg" border="0" height="42" width="820"
         alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today."/>
  </a>
</div>
<script src="js/html5shiv.js"></script>
<![endif]-->
<script src='~/js/device.min.js'></script>
<div class="page">
    <!--========================================================
                          HEADER
    =========================================================-->
    <header>

        <div id="stuck_container" class="stuck_container">
            <div class="wr">
                <div class="brand">
                    <img class="" src="@Umbraco.Media(CurrentPage.GetPropertyValue("logoHeader", true)).Url" />
                </div>
                <nav class="nav">
                    @{
                    var relatedPagesLang = Model.Content.Related<IPublishedContent>("LisaLangRel");
                    if (relatedPagesLang.Count() > 0)
                    {
                        var langRel = relatedPagesLang.First();
                        <a href="@langRel.Url"><img class="lang" src="@Umbraco.Media(langRel.GetPropertyValue("iconaLingua", true)).Url" /></a>
                    }


                }

                @Html.Partial("_MenuNavigazione")

            </nav>

        </div>
    </div>
</header>

@RenderBody()

<!--========================================================
                          FOOTER
=========================================================-->
<footer>
    <style type="text/css">
        footer{
            background: url(@Umbraco.Media(CurrentPage.GetPropertyValue("immagineSfondo", true)).Url) 50% 50% no-repeat;
        }
    </style>
    <section class="mobile-center">
        <div class="container">
            <div class="row">
                <div class="grid_4">
                    <h6>
                        @CurrentPage.GetPropertyValue("titoloNavigazione", true)
                    </h6>
                    @Html.Partial("_FooterNavigazione")
                </div>
                <div class="prefix_1 grid_3">
                    <h6>
                        @CurrentPage.GetPropertyValue("titoloServizi", true)
                    </h6>
                    @Html.Partial("_FooterServizi")

                </div>
                <div class="prefix_1 grid_3">
                    <div class="prefix_1 grid_3">
                        <h6>@CurrentPage.GetPropertyValue("titoloIndirizzo", true)</h6>
                        <div>
                            @Html.Raw(CurrentPage.GetPropertyValue("indirizzoFooter", true).Replace("\n", "<br />"))
                        </div>

                    </div>
                </div>
            </div>
            <section class="copyright">
                <div class="container">
                    © <span id="copyright-year"></span> @CurrentPage.GetPropertyValue("testoCopyright", true)
                </div>
            </section>
        </div>
    </section>




</footer>

And here's the homepage code:

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Homepage>
@using ContentModels = Umbraco.Web.PublishedContentModels;
@using Umbraco.Web.Models;
@using Comp.Umb.Lisa.Models;
@{
Layout = "Master.cshtml";

}
<link rel="stylesheet" href="/css/home.css">
<!--========================================================
                        CONTENT
  =========================================================-->
<main>
@Html.Partial("_Slider")
@{
    DynamicPublishedContent block = CurrentPage.Descendants("titolo_Immagine_Testo_bottone")[0];
    @Html.Partial("_TitleImgLeftTextButton", block);

}

<section class="well wow fadeIn ">
    @{ 
        DynamicPublishedContentList services = CurrentPage.Descendants("servizi").Any()? CurrentPage.Descendants("servizi").FirstOrDefault().Descendants("servizio").Take(4):new DynamicPublishedContentList();
    }
    <div class="container">
        <div class="row">
            @foreach(DynamicPublishedContent service in services)
            {
                @Html.Partial("_ServizioHP", service)
            }

        </div>

    </div>
</section>
@{ 
    DynamicPublishedContent textImg = CurrentPage.Descendants("testoImmagineSfondo").FirstOrDefault();
    @Html.Partial("_TextBackgroundImage", textImg);

    if (CurrentPage.Descendants("titolo_Immagine_Testo_bottone").Count() >= 2)
    {
        //DynamicPublishedContent secondBlock = CurrentPage.Descendants("titolo_Immagine_Testo_bottone")[1];
        @Html.Partial("_TitleImgLeftTextButton", (DynamicPublishedContent)CurrentPage.Descendants("titolo_Immagine_Testo_bottone")[1]);
    }


}
<hr />
    @if (CurrentPage.Descendants(LisaContansts.DocumentTypes.Clienti).Count() > 0)
    {
        @Html.Partial(LisaContansts.Partials.Clienti, (DynamicPublishedContent)CurrentPage.Descendants(LisaContansts.DocumentTypes.Clienti)[0])
    }
</main>
Cheat answered 10/3, 2017 at 8:29 Comment(3)
In general it is a good idea to include some lines of source code from your cshtml file. The information you provided is not really helpful for others to solve your problem.Altorilievo
thanks for reply, I added the code, I'm sorry for not properly correct postCheat
For future searches, I hope it is allowed to link here your umbraco forum topic: our.umbraco.org/forum/templates-partial-views-and-macros/…Ouabain
T
3

I encountered the same issue, what fixed it for me was editing the web.config and finding this value:

Umbraco.ModelsBuilder.ModelsMode

Changing it to Dll or LiveAppData instead of the default PureLive fixes it.

You can also set Umbraco.ModelsBuilder.Enable to false if you're not using the models builder functionality.

Tardy answered 22/8, 2017 at 9:1 Comment(0)
E
3

I also had this issue, I tried changing the ModelsMode, but it only changed the error message. The solution for me was simple matter of going back into the CMS and resaving the doctype. So ultimately I left it on PureLive and after saving everything came back.

Egon answered 11/1, 2018 at 17:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.