Closed AaronSadlerUK closed 3 years ago
I noticed the same error, but excluding "Contentment" folder in App_Plugins
fixed the issue locally. However I am not sure if that will work on Umbraco Cloud as I think it need to be included to be copied from repository to site.
Hmm ๐ค I'd removed the explicit namespace from the @inherits
of the Razor view, so to make it work with multi-targeting, for both v8 & v9). Obviously it doesn't, bah! Back to the drawing board... open to suggestions.
@leekelleher I haven't tested this, but maybe the approach @mattbrailsford used in Vendr Checkout? https://github.com/vendrhub/vendr-checkout/tree/v2/dev/src/Vendr.Checkout/Web/UI/App_Plugins/VendrCheckout/views
@leekelleher I haven't tested this, but maybe the approach @mattbrailsford used in Vendr Checkout? https://github.com/vendrhub/vendr-checkout/tree/v2/dev/src/Vendr.Checkout/Web/UI/App_Plugins/VendrCheckout/views
I was about to mention Matt ๐
Maybe it's a gap in my .NET Core (5) knowledge... is there a csproj setting to make it compile the Razor views? I thought Umbraco's default functionality was to disable that? (Only that I didn't get this error when I tested the package our during development)
I'm not sure how Matt achieved it, I think he mentioned it on Slack
@leekelleher there are the RazorCompileOnBuild and RazorCompileOnPublish settings in the csproj file, however the default csproj that comes with Umbraco v9 says to set those to "true" unless you are using Models Builder in InMemoryAuto mode.
Isnโt the default in the Umbraco template that those are set to false?
Yes. I believe the default is false, and the comment says to set them to true.
Oh, I see what you mean. The code comment says to set them to true.
Seems odd thatโs the case to me though as doesnโt that mean the back office settings section is potentially pretty useless once a site is published?
But if you're using Models Builder that would be correct as the DLLs are compiled... And any setting changes wouldn't be reflected anyway
Possibly, but that usually what we want for our production sites (and yes, I realize that isn't the case for everyone, just speaking for myself here). For most of the sites we create, we tell the clients to not touch anything in the Settings section. If there was a way to force read-only mode for that entire section for most people, I'd love it for most of our clients. We've had issues where people try to make changes there, but the changes never make it back to source control and then they lose them the next time we do an automated deploy.
Thanks @benjaminc, I'll give the RazorCompileOnBuild
setting a try. I must have only tested the package with it set to false
, (as @mattbrailsford says, Umbraco's default configuration).
I'm expecting it to be a quick fix. ๐
Update on this one. I added a _ViewImports.cshtml
file to the "~/App_Plugins/Contentment/render" directory, with the contents...
@using Umbraco.Cms.Web.Common.Views;
...and the project compiles fine. ๐
The reason I omitted the namespace from the Razor view is that the ContentBlockPreviewView
class has different namespaces between the v8 and v9 versions. Rightly or wrongly, I wanted to align them with Umbraco's namespaces for the view models.
I'll get a patch release out soon. ๐ (I'm doing the usual juggling work/family/OSS ๐คท๐)
Thanks for the update @leekelleher, no rush from me... the beta is currently working fine, I was only updating prior to launch on Sunday (31st) evening :)
Which Contentment version are you using?
3.0.0
Which Umbraco version are you using? For example: 8.14.1 - don't just write v8
9.0.1
Bug summary
Unable to build project after upgrading from the beta to 3.0.0 stable
Steps to reproduce
Upgrade from 3.0.0-beta001 to 3.0.0 stable
Expected result / actual result
Expected the project to build, instead I get the following errors:
Do you have Umbraco ModelsBuilder enabled?
What browsers are you seeing the problem on?
No response