Copied to clipboard

Flag this post as spam?

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


  • Christina 127 posts 390 karma points notactivated
    May 29, 2018 @ 08:00
    Christina
    0

    What is wrong with my project Cannot bind source content type

    Hi I hope someone can help me with my project I m using modelsbuilder mode AppData I get this error all the time

    Cannot bind source content type Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedContent to model content type Umbraco.Web.PublishedContentModels.Home.
    

    I have a masterpage and a home template and even if i comment out everything it still get error. If I attatche webconfig rebuild the site its working but everytime i change the code i get this, what Im i doing wrong? /Christina

  • Steve Morgan 1349 posts 4459 karma points c-trib
    May 29, 2018 @ 08:16
    Steve Morgan
    0

    Hi Christina,

    Are you seeing this message on the Homepage (and checked the document type of your Homepage is "Home") or is this on all other pages but your homepage works?

    If it's happening on other pages then you may have accidentally copied over from your homepage View and not see that the doc type changes on your View in the first line (where it says YourDocTypeAlias below).

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.YourDocTypeAlias>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    

    Ensure this matches the document type of the page being requested (as that is what is being passed when Umbraco tries to load that page - if it doesn't match it will error.

    If you think this is correct then go to the Umbraco backend - look for the Models tab and rebuild your models and look for any health warnings. When you rebuild them post any errors in your log here and I'm sure we can help.

    HTH

    Steve

  • Christina 127 posts 390 karma points notactivated
    May 29, 2018 @ 08:23
    Christina
    0

    Hi Steve

    Thanks I use the correct Model on each template, i went to the developer section and went throw the health check . Now its working i hope /Christina

  • Steve Morgan 1349 posts 4459 karma points c-trib
    May 29, 2018 @ 08:28
    Steve Morgan
    104

    You might want to review what settings you have for Models Builder. Some options mean that for every change you make to DocTypes requires you to manually rebuild the models.

    There's a good (but a little dated in places) overview here https://24days.in/umbraco-cms/2016/getting-started-with-modelsbuilder/

  • Christina 127 posts 390 karma points notactivated
    May 29, 2018 @ 08:37
    Christina
    0

    Thanks!

  • Christina 127 posts 390 karma points notactivated
    May 29, 2018 @ 08:54
    Christina
    0

    It didn't help I get different .cs files all the time It starts with Cannot bind source content type Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedContent to model type Umbraco.Web.PublishedContentModels.Home. And then

    \AppData\Local\Temp\Temporary ASP.NET Files\vs\961f8b06\3a66f35d\App_Web_home.cshtml.65a2d1ee.4mrpgp38.0.cs 
    

    I dont get any errors in modelsbuilder or in code im using Umbraco version 7.10.4 /Christina

  • Christina 127 posts 390 karma points notactivated
    May 29, 2018 @ 11:03
    Christina
    0

    My error

    This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240

    c: \ Users \ c \ AppData \ Local \ Temp \ Temporary ASP.NET Files \ vs \ 961f8b06 \ 3a66f35d \ AppWebhome.cshtml.65a2d1ee.epzdj9nb.0.cs (42.90): error CS0234: Type or Name Area Name Home is not in the Umbraco.Web.PublishedContentModels namespace (missing a compilation reference?)

    Line 42:   public class _Page_Views_home_cshtml : Umbraco.Web.Mvc.UmbracoViewPage<ContentModels.Home> {
    

    Line Line 89: BeginContext("~/Views/home.cshtml", 417, 15, true); Line 90:
    Line 91: WriteLiteral(">\r\n <section");

    In visual Studio Severity Code Description Project File Line Suppression State Warning AD0001 Analyzer 'Microsoft.CodeAnalysis.CSharp.Analyzers.FixAnalyzers.CSharpFixerWithFixAllAnalyzer' threw an exception of type 'System.TypeInitializationException' with message 'The typinitier for Microsoft.CodeAnalysis.Analyzers.FixAnalyzers.FixerWithFixAllAnalyzer`1 triggered an exception.'.

  • Andy Felton 185 posts 484 karma points c-trib
    May 29, 2018 @ 11:53
    Andy Felton
    0

    Hi Christina,

    Can you confirm which mode you have the Models Builder in. This setting will set how and when models are rebuilt.

    Thanks Andy

  • Christina 127 posts 390 karma points notactivated
    May 29, 2018 @ 12:01
    Christina
    0

    Hi Andy Thanks I copied this from Modelsbuilder /C

    ModelsBuilder is enabled, with the following configuration: The models factory is enabled. The API is neither installed nor enabled. External tools such as Visual Studio cannot use the API. AppData models are enabled. Models namespace is Umbraco.Web.PublishedContentModels. Static mixin getters are enabled. The pattern for getters is "Get{0}". Tracking of out-of-date models is enabled.

  • Andy Felton 185 posts 484 karma points c-trib
    May 29, 2018 @ 13:13
    Andy Felton
    0

    Hi Christina,

    That would mean you're in AppData mode - this is the one we use. With AppData models are only generated when you click the button in the back office. This should create you a file for each doc type in App_Data/Models each of the form *.generated.cs. Have you included these file in to your Visual Studio project?

    Thanks Andy

  • Christina 127 posts 390 karma points notactivated
    May 29, 2018 @ 14:52
    Christina
    0

    Hi Andy Thanks yes I have /Christina

  • Andy Felton 185 posts 484 karma points c-trib
    May 29, 2018 @ 14:59
    Andy Felton
    0

    Hi,

    Can you describe your environment IE how you're running this is it a local dev machine, server, IIS, Visual Studio, etc? May help understand the issue?

    Thanks Andy

  • Christina 127 posts 390 karma points notactivated
    May 29, 2018 @ 18:46
    Christina
    0

    Hi Andy Many thanks for helping me Im using local machine Windows 10 pro, Visual Studio 2017, MySQL, IIS Express. .NET 4.52

    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    

    /Christina

  • Andy Felton 185 posts 484 karma points c-trib
    May 29, 2018 @ 19:27
    Andy Felton
    0

    Hi Christina,

    This is beginning to make less and less sense!

    Can you check the file App_Data\Models\Home.generated.cs and confirm the namespace is Umbraco.Web.PublishedContentModels.

    Also can you send me a copy of the dll generated for the website so I can confirm if the error we're being told is an actual error (pop it in dropbox or something).

    Thanks Andy

  • Christina 127 posts 390 karma points notactivated
    May 30, 2018 @ 08:16
    Christina
    0

    Hi Andy Thanks a lot

    I have checked the generated files and the namespace is Umbraco.Web.PublishedContentModels

    Christina

  • Andy Felton 185 posts 484 karma points c-trib
    May 30, 2018 @ 09:12
    Andy Felton
    0

    Hi Christina,

    I've looked at the DLL and can confirm the PublishedContentModels namespace is in there and has the home class. Not sure what to suggest next!

    Thanks Andy

  • Christina 127 posts 390 karma points notactivated
    May 30, 2018 @ 13:06
    Christina
    0

    Thanks a lot Andy

    I think I found the error, in the beginning i started building models with the same namespace Umbraco. /Christina

  • Andy Felton 185 posts 484 karma points c-trib
    May 30, 2018 @ 13:47
    Andy Felton
    0

    Hi Christina,

    Glad you've found it!

Please Sign in or register to post replies

Write your reply to:

Draft