Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

PageType preview thumbnail from other project

Vote:
 

Hi,

as we use multible projects in one solution

Solution
ModulesProject
   /Modules/Pages/...
   /Modules/Blocks/...
MyOptimizely
/... some stuff in here

I want to place the PageType or BlockType Prevview Icons inside the "ModulesProject/Modules" path. But when i try to accesss them with the annotation in the PageController

[ImageUrl("/Modules/Pages/Other/Ressources/Img/Icons/page-type-thumbnail-standard.png")]

it can't be found in MyOptimizely. I tried with

<ItemGroup>
  <Content Include="Modules\Pages\Standard\Assets\*.*">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  </Content>
</ItemGroup>

in the moduleproject.csproj, but the "PageIcons" just don't appear.

Is it possible to place the "Block"-Thumbnails inside the ModulesProject at all, or do I have to tell some CI-Pipeline to copy the stuff for me?

Have a great week,

Ralph

#294364
Jan 09, 2023 9:31
Vote:
 

It's the content type you should add the ImageUrl attribute to, not the controller.

#294375
Edited, Jan 09, 2023 14:40
Vote:
 

Yes you are right. I had this in the PageTypeModel. Please ignore the PageController ;-)

namespace Modules.Pages.Standard.Models
{
    [ContentType(
        DisplayName = "Standard Page",
...
        Order = 1)]
  [ImageUrl("/Modules/Pages/Other/Ressources/Img/Icons/page-type-thumbnail-standard.png")]
    public class StandardPage : PageData
    {
...

Sorry

#294376
Edited, Jan 09, 2023 14:56
Vote:
 

Pretty sure you need to make the images emedded resources 

#294412
Jan 10, 2023 0:40
Vote:
 

You don't, but you need to put them where the static file middleware can serve them (or configure the middleware to use the location where they are now).

#294415
Jan 10, 2023 7:33
Vote:
 

How do I copy the stattic files to the location. I thought the "<CopyToOutputDirectory>Always</CopyToOutputDirectory>" did the trick. Even with a destination folder set, the file isn't there.

#294418
Jan 10, 2023 9:09
Vote:
 

<CopyToOutputDirectory> element has an effect mostly in the current project. You can achieve this with build actions inside .csproj file. But this might work only on local development environment.

I needed to copy modules files to test Alloy sample app in my package solution (normally it would be done while installing NuGet package) - but locally, to avoid manual copy, I added this snippet to my .csproj file.

#294984
Jan 19, 2023 17:22
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.