Copied to clipboard

Flag this post as spam?

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


  • Mateusz Kotwica 29 posts 129 karma points
    1 week ago
    Mateusz Kotwica
    0

    Custom dashboard from external project

    Hi,

    I'm trying to create a custom dashboard where all the assets and code will sit in the dedicated project (class library).

    I've created all the views, scripts and styles as well as manifest file and everything works well when I keep above files in the App_Plugins directory within main CMS project.

    When I move the assets for my dashboard to the App_Plugins in my external project, my custom view disappears with no error. What is funny, the assets are correctly copied to the bin directory.

    I've tried with implementing manifest via C# code but even when I'm able to at least see the dashboard tab, I'm receiving an error that the view is missing: enter image description here What am I doing wrong?

  • Bo Jacobsen 597 posts 2395 karma points
    1 week ago
    Bo Jacobsen
    1

    Hi Mateusz.

    You cannot use a class library for the containment of the /App_Plugins/ files.

    You need to create a Razor Class Library which is intended for this purpose.

    Markus wrote something about it here: https://www.enkelmedia.se/blogg/2023/5/9/converting-a-umbraco-package-to-a-razor-class-library

  • Mateusz Kotwica 29 posts 129 karma points
    1 week ago
    Mateusz Kotwica
    0

    Hi Bo,

    thank you for the clue! I'll try it out!

  • Bo Jacobsen 597 posts 2395 karma points
    1 week ago
    Bo Jacobsen
    1

    Btw.

    Kevin Jump also wrote a very good guide in steps here: https://dev.to/kevinjump/umbraco-10-razor-class-library-packages-pt1-3nfa

    Hope it gets you on the right track.

  • Luuk Peters 84 posts 325 karma points
    1 week ago
    Luuk Peters
    0

    I think the missing step is that the AppPlugins folder needs to be copied to the AppPlugins folder of your CMS project. It needs those files to be in the CMS project.

    If you start a new Umbraco package project using the Umbraco template for a package, you'll see that you need a targets file that takes care of this. This file makes sure that AppPlugins folder of your package is copied to the AppPlugins folder of you CMS when you build the CMS project that uses the package.

    So you should have a folder in your package project called buildTransitive which should have a file called -projectname-.targets.

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <UmbracoPackage1ContentFilesPath>$(MSBuildThisFileDirectory)..\App_Plugins\UmbracoPackage1\**\*.*</UmbracoPackage1ContentFilesPath>
      </PropertyGroup>
    
      <Target Name="CopyUmbracoPackage1Assets" BeforeTargets="BeforeBuild">
        <ItemGroup>
          <UmbracoPackage1ContentFiles Include="$(UmbracoPackage1ContentFilesPath)" />
        </ItemGroup>
        <Message Text="Copying UmbracoPackage1 files: $(UmbracoPackage1ContentFilesPath) - #@(UmbracoPackage1ContentFiles->Count()) files" Importance="high" />
        <Copy SourceFiles="@(UmbracoPackage1ContentFiles)" DestinationFiles="@(UmbracoPackage1ContentFiles->'$(MSBuildProjectDirectory)\App_Plugins\UmbracoPackage1\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
      </Target>
    
      <Target Name="ClearUmbracoPackage1Assets" BeforeTargets="Clean">
        <ItemGroup>
          <UmbracoPackage1Dir Include="$(MSBuildProjectDirectory)\App_Plugins\UmbracoPackage1\" />
        </ItemGroup>
        <Message Text="Clear old UmbracoPackage1 data" Importance="high" />
        <RemoveDir Directories="@(UmbracoPackage1Dir)" />
      </Target>
    </Project>
    

    This file is responsible for copying the AppPlugins folder of your package to the AppPlugins folder of your CMS on build.

Please Sign in or register to post replies

Write your reply to:

Draft