Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm attempting to build out a simple site on Umbraco 9 and .NET Core, mainly for testing purposes.
However, PublishedModels is behaving odd. I see the generated models under ~/umbraco/models/, but the razor views do not recognize PublishedModels.XXXX (i.e. @inherits UmbracoViewpage
Does anyone know what I might be doing wrong? Or where in appsettings to change modelbuilder mode since I don't have web.config?
I'd appreciate any help.
EDIT: To be more thorough, the error is "The type for namespace 'Homepage' does not exist in 'Umbraco.Cms.Web.Common.PublishedModels'
There's are few things to notice here:
The error you see is expected when using PureLive mode in ModelsBuilder.
You should be able to build the solution, even when there are compile-time errors in views, if you have the following setting in the project file (Default when using the Umbraco templates):
<!--Set this to true ModelsBuilder mode is not PureLive -->
The mode of the embedded ModelsBuilder can be changed in any of the JSON files using this code snippet:
Or you can change it from code, if you expect to use the same mode in all environments, by adding this to your Startup.ConfigureServices
public void ConfigureServices(IServiceCollection services)
options.ModelsMode = ModelsMode.AppData;
We had an issue where the models just would not work in the default location. (/umbraco/models), even custom classes we added here could not be discovered.
You can change the default models location though the configuration settings to see if you are running into the same issue as we did.
Note that the default location is added as type None by default. You will need to add these as Content, like you did in v8, as soon as you use AppData.
There is an up-for-grabs feature request about writing the Purelive models to another folder, so this folder could be Content by default.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted