Copied to clipboard

Flag this post as spam?

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


  • Rene M. Macalisang 7 posts 76 karma points
    Mar 04, 2024 @ 12:07
    Rene M. Macalisang
    0

    Calling partial views from another project

    I have an umbraco 13 solution and it has 2 projects, I want to reuse my partial views in another project. However, upon calling the partial views I encounter and error "InvalidOperationException: The partial view '~/Views/Partials/Content/Buttons.cshtml' was not found. The following locations were searched: ~/Views/Partials/Content/Buttons.cshtml". These two projects has a reference.

    enter image description here

    enter image description here What I need to do to call the partial view?

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Mar 05, 2024 @ 09:54
    Nik
    0

    Hi Rene,

    In order to ship razor views with your feature DLL you need to make your feature DLL a razor class library.

    In order to do this you will need to update you CSProj file with the following updates:

    1. Update the project type:

         <Project Sdk="Microsoft.NET.Sdk.Razor">
      
    2. Add support for Razor MVC:

      <AddRazorSupportForMvc>true</AddRazorSupportForMvc>
      

    I "think" that should do the job.

    Nik

Please Sign in or register to post replies

Write your reply to:

Draft