Copied to clipboard

Flag this post as spam?

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


  • Alexandre Locas 52 posts 219 karma points
    May 04, 2022 @ 12:54
    Alexandre Locas
    0

    Compile views

    Hi, after deployment of our website on Azure, first access to each doc type is slow.

    I would like to compile views.

    With v8 the msbuild PrecompileBeforePublish=true switch was available.

    How can this be done with v9 ?

    I've tried the following : https://github.com/umbraco/Umbraco-CMS/issues/11758 without success.

    Note : We are using .net core 6.

    Thank you

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 10x admin c-trib
    May 06, 2022 @ 09:32
    Dave Woestenborghs
    0

    Hi Alexandre

    For Umbraco 9 this can be done directly in your csproj file of your website.

      <!-- Set this to true if ModelsBuilder mode is not InMemoryAuto-->
      <PropertyGroup>
        <RazorCompileOnBuild>true</RazorCompileOnBuild>
        <RazorCompileOnPublish>true</RazorCompileOnPublish>
      </PropertyGroup>
    

    Dave

  • Alexandre Locas 52 posts 219 karma points
    May 06, 2022 @ 10:58
    Alexandre Locas
    0

    Thanks Dave, but I have tried this and it does not work.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 10x admin c-trib
    May 06, 2022 @ 11:34
    Dave Woestenborghs
    0

    Hi Alexandre,

    For me that works. I see a dll {ProjectName}.Views.dll in my bin folder when setting these values to true.

    Can you check that.

    Dave

  • Alexandre Locas 52 posts 219 karma points
    May 06, 2022 @ 15:24
    Alexandre Locas
    0

    I do not see any xxx.Views.dll generated.

    Are you using .net core 6 ?

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 10x admin c-trib
    May 07, 2022 @ 08:03
    Dave Woestenborghs
    0

    Hi Alexandre,

    I am running .NET 5

    But for me that dll shows up after I build the project.

    Dave

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 10x admin c-trib
    May 07, 2022 @ 08:22
    Dave Woestenborghs
    100

    Hi Alexandre,

    From .NET 6 it won't produce a seperate assembly anymore.

    See https://docs.microsoft.com/en-us/dotnet/core/compatibility/aspnet-core/6.0/razor-compiler-doesnt-produce-views-assembly

    Dave

  • Alexandre Locas 52 posts 219 karma points
    May 09, 2022 @ 12:43
    Alexandre Locas
    0

    You are right thank you!

    Any idea why it works when compiling but not when publishing ? (event if RazorCompileOnPublish is set to true)

  • 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