Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Davide Borghi 4 posts 73 karma points
    Mar 09, 2017 @ 17:09
    Davide Borghi
    0

    Exception: Views was not created

    Hi guys, this is my first post in this forum. I hope to do it correctly. I have been looking for a solution for hours 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 enter image description here

    This is the thrown exception: "System.InvalidOperationException: The view found at '~/Views/Homepage.cshtml' was not created." I had the same issue in all pages that I create. Any Ideas? enter image description here

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Mar 10, 2017 @ 13:39
    Alex Skrypnyk
    0

    Hi Davide

    Do you have this view in your views folder?

    '~/Views/Homepage.cshtml' ?

    Can you share the code of this view? Is there is right permissions on folders of this site?

    Thanks,

    Alex

  • Davide Borghi 4 posts 73 karma points
    Mar 10, 2017 @ 14:20
    Davide Borghi
    0

    Hi alex,
    thanks for reply.
    yes, I have the view in my folder
    enter image description here
    I post here homepage's code, but I'm pretty sure that it isn't a code issue. Exception is thrown in all my pages.

    here's my 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>
    

    and here my "master" (layuot) 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="preffix_1 grid_3">
                        <h6>
                            @CurrentPage.GetPropertyValue("titoloServizi", true)
                        </h6>
                        @Html.Partial("_FooterServizi")
    
                    </div>
                    <div class="preffix_1 grid_3">
                        <div class="preffix_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>
    

    While my post was under moderation this new topic appeared that seems to talk about the same issue

    waiting for other ideas
    Thanks

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Mar 10, 2017 @ 14:36
    Alex Skrypnyk
    0

    Hi Davide

    By the way did you include your views in dlls while build?

    Check please below lines in .csproj file.It will compile views

    <PropertyGroup>
        <MvcBuildViews>true</MvcBuildViews>
    </PropertyGroup>
    

    Alex

  • Davide Borghi 4 posts 73 karma points
    Mar 10, 2017 @ 15:32
    Davide Borghi
    0

    In my .csproj those lines was missing, so I add them but result doesn't change.
    same error.

    Hoping for others suggestions. Thanks

  • Nico 10 posts 77 karma points
    Mar 21, 2017 @ 08:04
    Nico
    1

    Exactly the opposite here. Not working with debugging, but no issue when running without debugging.

    New 7.5.11 install using Nuget .

  • James Meredith 18 posts 91 karma points
    Mar 30, 2017 @ 08:24
    James Meredith
    2

    Hi Davide,

    I was having a similar problem on v7.5.11 but the other way round where without debugging worked and with didn't. The way I fixed it in my case was changing the Models Builder Mode to Dll in the web.config shown below:-

    <add key="Umbraco.ModelsBuilder.ModelsMode" value="Dll"/>
    

    Then going into the umbraco backend developer section > Models Builder Tab > "Generate models" to ensure the dll is created. I then finally add the Umbraco.Web.PublishedContentModels.dll that was created to my project references.

    Hope this helps,

    James

  • Carlos Soares Dias 1 post 72 karma points
    Jul 05, 2017 @ 03:00
    Carlos Soares Dias
    1

    Hey, thank you. This worked for me.

  • blackhawk 313 posts 1368 karma points
    Dec 18, 2017 @ 18:28
    blackhawk
    0

    Thank you James, that worked

  • reinjunon 7 posts 97 karma points
    Apr 22, 2017 @ 07:49
    reinjunon
    0

    I've tried the above methods and they dont work. Umbraco tv has no guide on this either.

  • reinjunon 7 posts 97 karma points
    Apr 22, 2017 @ 11:39
    reinjunon
    0

    The project is corrupted most likely.

    Refer to below. Got it resolved by using a clean version.

    https://our.umbraco.org/forum/using-umbraco-and-getting-started/85288-issues-with-publishing-from-visual-studios

  • Pavel 11 posts 82 karma points
    Aug 20, 2017 @ 06:04
    Pavel
    0

    This is a very strange issue.. happens every time I simply copy umbraco based site.. original works fine, copy throws that error. It'd be really good if someone could shed some light on it. I can't pinpoint actual issue here.

  • Ralph de Ruijter 2 posts 71 karma points
    Aug 21, 2017 @ 13:17
    Ralph de Ruijter
    0

    I did exactly the same: copy an umbraco website, the original works ok. The copy has this error.

  • Ralph de Ruijter 2 posts 71 karma points
    Aug 21, 2017 @ 15:07
    Ralph de Ruijter
    0

    I may have found a work around:

    1. I changed the connectionstring to the original database for the copied umbraco installation.
    2. Run the copied umbraco website
    3. The view is now fixed
    4. Stopped the copied umbraco website
    5. Changed the connectionstring back to the copied database
    6. Run the copied umbraco website again
    7. The view is still fixed.

    I am not sure why, but I am glad it fixed the problem. But I am still hoping for a better solution than this.

  • Fergus Davidson 309 posts 588 karma points
    Sep 07, 2017 @ 14:06
    Fergus Davidson
    0

    i have exactly the same issue as Pavel above - i clone a site, and database - a straight duplicate of DB and files.

    I get an error:

    The view found at '~/Views/the-name-of-the-view-here.cshtml' was not created.

  • Fergus Davidson 309 posts 588 karma points
    Sep 07, 2017 @ 14:53
    Fergus Davidson
    2

    i have faffed around for a while and tried a few things. It is working now, and i think that the thing that sorted it out was:

    change

    <add key="Umbraco.ModelsBuilder.ModelsMode" value="PureLive" />
    

    to

    <add key="Umbraco.ModelsBuilder.ModelsMode" value="AppData" />
    

    click generate models in the developer section

    change

    <add key="Umbraco.ModelsBuilder.ModelsMode" value="AppData" />
    

    back to

    <add key="Umbraco.ModelsBuilder.ModelsMode" value="PureLive" />
    

    all seems working now.

  • Norbert Virth 1 post 71 karma points
    Sep 15, 2017 @ 11:14
    Norbert Virth
    0

    I'm totally new to Umbraco, just started to learn it yesterday. I've installed v7.6.6 via nuget, and later let umbraco install a default site template into my project.
    Yesterday it worked, today I had the very similar error message:

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


    The solution by me was located in Web.config. I pressed F5 today in VS, and this window appeared:
    Debugging not enabled alert
    I've let it modify the web.config to be able to debug. This was the problem by me, I had to restore the original web.config (and maybe also a rebuild was necessary to regenerate all.dll.path). Now I'm unable to debug it though

    In the web config, only this section was touched:

    <compilation defaultLanguage="c#" debug="false" ... />
    


  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    Sep 15, 2017 @ 20:55
    Rune Hem Strand
    5

    I've seen this a couple of times as well. It is usually the models from modelsbuilder (in PureLive mode) that for some reason have not ben generated correctly. It can usually be resolved by going to a document type and pressing save.

    This also explains why changing the modelsbuilder mode from PureLive to AppData or Dll fixes the issues. The models will be rebuilt

  • Hong 66 posts 228 karma points
    May 09, 2018 @ 23:16
    Hong
    0

    The save button is like a magic wand that solves this problem instantly.

  • Russ Huntington 1 post 77 karma points
    Sep 19, 2017 @ 08:24
    Russ Huntington
    6

    I experienced the same issue during an Umbraco training course - the solution was to re-save the document type of that template.

  • Carlos Mosqueda 240 posts 431 karma points
    Dec 22, 2017 @ 20:55
    Carlos Mosqueda
    0

    Yep, this seems to be the fix for me. Totally makes sense now that I think of it. Since it was in training and it happened. Typically the best fix comes from figuring those out in training.

  • Ricardo França 1 post 71 karma points
    Oct 27, 2017 @ 22:04
    Ricardo França
    0

    I had the same issue.

    In my case I was using the Local IIS and changed to use IIS express, but the port that VS was serving was different. I was able to access the port 12345, the umbraco page was loading successfuly but the site wasn't.


    To solve the problem I've changed those two lines to use the same port:

    <DevelopmentServerPort>58939</DevelopmentServerPort>
    <IISUrl>http://localhost:12345</IISUrl>;
    
  • Sam 79 posts 426 karma points
    Nov 29, 2017 @ 20:17
    Sam
    0

    I experienced the issue as well. I was able to fix by re creating the HomePage template.

    log in and go to template. copy code. Delete the template, create new template under the same name, and paste in copied code.

    you will have to update the doc types that were using the old template by re-selecting the new one. and then you will have to save and publish the content that have that template selected.

    after doing this the issue was resolved.

  • Pavel 11 posts 82 karma points
    Dec 04, 2017 @ 14:19
    Pavel
    1

    Yes re-saving doc types did fix it. Although it would've been really good to understand the actual cause and fix properly..

  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    Dec 05, 2017 @ 15:56
    Rune Hem Strand
    0

    If you look at my answer above that holds a partial explanation at least :) It looks like the modelsbuilder did not complete the generation of models correctly. When you resave a document type the models are rebuilt and that is why it works.

    If you want to inspect it further try having a look at /App_Data/Models/ next time it occurs and compare to trace logs to see if you can spot what is wrong.

    Seems likely that something interfered with the modelsbuilder before it finished generating the models.

    All the best
    Rune

  • George 3 posts 73 karma points
    Dec 04, 2017 @ 14:53
    George
    0

    I've also run into this error when my browser is pointed to the .cshtml itself. If you run the site when the Visual Studio editor for Homepage.cshtml is open, sometimes it will open my browser to mysite/Views/Homepage.cshtml instead of mysite/.

  • Steffen Muldbjerg 6 posts 37 karma points
    Dec 10, 2017 @ 21:42
    Steffen Muldbjerg
    0

    I have the same problem, I run Umbraco 7.7.2 SQL CE. I have tried re-saving the doc types, and changing it to AppData and back again. It helps immediately - but det next day the same problem occurs. It has been so for the last month - what can I do, not to resave first thing every morning?

    Hope someone are able to help.

  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    Dec 11, 2017 @ 18:32
    Rune Hem Strand
    0

    Hey Steffen

    That sounds very odd indeed. Haven't heard of it recurring on a nightly basis.

    Try setting the modelsbuilder to run in Dll mode permantly. That should hopefully work. This will compile the models to a dll in the /bin folder.

    You can do this in web.config by changing

    <add key="Umbraco.ModelsBuilder.ModelsMode" value="PureLive" />
    

    to

    <add key="Umbraco.ModelsBuilder.ModelsMode" value="Dll" />
    

    do make sure the models are properly generated. This can be done on the modelsbuilder dashborad in the Developer section.

    Let me know how it goes!

    All the best
    Rune

  • Steffen Muldbjerg 6 posts 37 karma points
    Dec 13, 2017 @ 12:23
    Steffen Muldbjerg
    1

    Thank you very much Rune! The switch to Dll mode removed my troubles, after I regenerated my models.

    enter image description here

  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    Dec 21, 2017 @ 10:39
    Rune Hem Strand
    0

    Thanks for reporting back :) Glad it helped!!

  • Stephen 767 posts 2273 karma points c-trib
    Dec 11, 2017 @ 18:31
    Stephen
    0

    The message "the view found at ... was not created" indicates that MVC could find the view (so, no problem finding nor accessing the cshtml file) and quite probably compiling the view was successful (else we would get an exception), but for some reason MVC failed to initialize an instance of the view.

    Could very well be due to something dirty happening with ModelsBuilder - as it seems that switching MB mode back and forth fixes the issue.

    In PureLive mode, MB keeps a cache of the compiled models DLL + some hash files and a bit of plumbing - it could be that creating a "copy" of a site confuses MB.

    Investigating.

  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    Dec 11, 2017 @ 18:33
    Rune Hem Strand
    0

    Usually re-saving a doc type "fixes" the issue - so seems very likely it has something to with modelsbuilder.

  • Stephen 767 posts 2273 karma points c-trib
    Dec 21, 2017 @ 09:30
    Stephen
    0

    Root cause of the issue has (hopefully) been identified. Is linked to the fact that when models compilation fails for some reason, ASP.NET deletes the existing models DLL at some point, but we did not force views to recompile, so they would use reference a (now) non-existing DLL.

    See issue at http://issues.umbraco.org/issue/U4-10780

  • Sebastiaan Janssen 5045 posts 15476 karma points MVP admin hq
    Jan 08, 2018 @ 11:42
    Sebastiaan Janssen
    0

    Just as an update: Stephen found a way to reproduce this reliably now and found the proper fix for it. If you want it fixed now: update to Modelsbuilder 3.0.8 manually.

    This fix will be part of the 7.6.13 and 7.7.8 releases which are due out tomorrow.

Please Sign in or register to post replies

Write your reply to:

Draft