Copied to clipboard

Flag this post as spam?

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


  • andrew shearer 513 posts 663 karma points
    Feb 01, 2023 @ 21:24
    andrew shearer
    0

    .net core razor compilation and umbraco forms themes

    Hi – as part of our devops process and Umbraco runtime mode configuration for production https://docs.umbraco.com/umbraco-cms/fundamentals/setup/server-setup/runtime-modes , we have razor compilation turned on (RazorCompileOnPublish). (this is in umbraco 10 / net core)

    However, we also use Umbraco Forms themes https://docs.umbraco.com/umbraco-forms/developer/themes/ and have a custom view file in “Views\Partials\Forms\Themes\our-theme-name\Fieldtypes”.

    As that file doesn’t exist in our net publish folder (it’s a razor file so its getting compiled into an assembly), Umbraco Forms can’t find it on disc so it isn’t being applied/used.

    How are people working around this? My first thought was to have our theme views in a different folder from Views and then copy them into views folder as part of our publishing process (CICD). Is there a better/preferred way?

    Thanks

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Feb 02, 2023 @ 07:50
    Dave Woestenborghs
    0

    Hi Andrew,

    Do you have this on your csproj file of your web project

       <PropertyGroup>
        <!-- Razor files are needed for the backoffice to work correctly -->
        <CopyRazorGenerateFilesToPublishDirectory>true</CopyRazorGenerateFilesToPublishDirectory>
      </PropertyGroup>
    

    We also compile our razor views, but are not facing the issue you are describing.

    Dave

  • andrew shearer 513 posts 663 karma points
    Feb 02, 2023 @ 20:09
    andrew shearer
    0

    thanks Dave! that looks like the setting im after and will try it out today. right there on the page i linked to too. my bad #facepalm

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies