Copied to clipboard

Flag this post as spam?

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


  • Arjan H. 226 posts 463 karma points c-trib
    Aug 25, 2022 @ 09:27
    Arjan H.
    0

    How to override Razor Class Library (RCL) content?

    I've used these articles to convert my custom packages to Razor Class Libraries (RCL). I'm struggling with overriding the RCL content though. It should be possible to override RCL content by putting a physical file in the folder structure of the website project. I've been testing this with a really simple 'hello world' property editor package. This package contains an index.html view in the root of the package folder structure. But when I add a physical file to the Umbraco v10 website project (/App_Plugins/HelloWorldPackage/index.html) and make some changes to this file, these changes are not reflected in the Umbraco backoffice. It still shows the RCL version of the view. Any idea what I could be doing wrong?

    Here's the repo: https://github.com/creativesuspects/UmbracoPackageRCL

  • Kevin Jump 2342 posts 14889 karma points MVP 8x c-trib
    Aug 25, 2022 @ 11:36
    Kevin Jump
    0

    Hi,

    I am not sure the static files are overridden in the same way as compiled razor views are in a RCL - but it might still work if you put them in a diffrent location .

    i would try wwwroot/app_plugins/hellowworldpackage/index.html as i think that is the first place the site will actuall look, it might be that the Umbraco file provider that allows you to use the /app_plugins folder is actually below the razor one in the list

  • Arjan H. 226 posts 463 karma points c-trib
    Aug 25, 2022 @ 13:45
    Arjan H.
    0

    Hey Kevin, thanks for the input! I already tried putting the file in /wwwroot/App_Plugins/HelloWorldPackage/index.html, but that doesn't work either, as in the RCL version is still being used. Plus when I do that I can't publish the site anymore, because that results in the following error:

    Conflicting assets with the same target path 'App_Plugins/HelloWorldPackage/index.html'. For assets 'Identity: D:\Dev\UmbracoPackageRCL\src\HelloWorldPackage\wwwroot\index.html, SourceType: Project, SourceId: HelloWorldPackage, ContentRoot: D:\Dev\UmbracoPackageRCL\src\HelloWorldPackage\wwwroot\, BasePath: App_Plugins/HelloWorldPackage, RelativePath: index.html, AssetKind: All, AssetMode: All, AssetRole: Primary, RelatedAsset: , AssetTraitName: , AssetTraitValue: , CopyToOutputDirectory: Never, CopyToPublishDirectory: PreserveNewest, OriginalItemSpec: wwwroot\index.html' and 'Identity: D:\Dev\UmbracoPackageRCL\src\Umbraco.Cms.10x\wwwroot\App_Plugins\HelloWorldPackage\index.html, SourceType: Discovered, SourceId: Umbraco.Cms.10x, ContentRoot: D:\Dev\UmbracoPackageRCL\src\Umbraco.Cms.10x\wwwroot\, BasePath: _content/Umbraco.Cms.10x, RelativePath: App_Plugins/HelloWorldPackage/index.html, AssetKind: All, AssetMode: All, AssetRole: Primary, RelatedAsset: , AssetTraitName: , AssetTraitValue: , CopyToOutputDirectory: Never, CopyToPublishDirectory: PreserveNewest, OriginalItemSpec: wwwroot\App_Plugins\HelloWorldPackage\index.html' from different projects.
    

    I think you're right in that static files don't work the same way as compiled razor views in a RCL. That would be a bummer though, because you wouldn't be able to customize/hack existing RCL packages when needed.

Please Sign in or register to post replies

Write your reply to:

Draft