Copied to clipboard

Flag this post as spam?

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


  • Daniel Rogers 134 posts 712 karma points
    Jan 06, 2023 @ 04:18
    Daniel Rogers
    0

    Trying to create a package

    trying to create my first simple package some js/css/html form app_plugins folder and a dll

    the dll complies and copies to the bin folder when installing the package.

    files for the dll copied from original project so the code is tested in the project.

    However the dll doesn't appear to run. it should add a ISection and IDashboard

    1. none of the app_plugin folders or files copy.

    project file

    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <TargetFramework>net7.0</TargetFramework>
        <Product>IBDStarterKit.Core</Product>
        <PackageId>IBDStarterKit</PackageId>
        <Title>IBDStarterKit</Title>
        <Description>Core Library Files used in our products</Description>
        <PackageTags>Umbraco</PackageTags>
        <Copyright>Daniel Rogers - Intelligence By Design PTY LTD</Copyright>
        <Version>1.0.0</Version>
        <Authors>Daniel Rogers</Authors>
        <Company>Intelligence By Design PTY LTD</Company>
        <PackageProjectUrl>https://intelligencebydesign.com.au</PackageProjectUrl>;
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
        <FileVersion>1.0.0</FileVersion>
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="Umbraco.Cms.Web.Website" Version="11.0.0" />
        <PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="11.0.0" />
      </ItemGroup>
    
      <ItemGroup>
        <Content Include="App_Plugins\IBDStarterKit\**\*.*">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
        <None Include="buildTransitive\**" Pack="true" PackagePath="buildTransitive" />
      </ItemGroup>
    </Project>
    

    the .targets file is self generated by vs2022 umbracko package

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <IBDStarterKitContentFilesPath>$(MSBuildThisFileDirectory)..\App_Plugins\IBDStarterKit\**\*.*</IBDStarterKitContentFilesPath>
      </PropertyGroup>
    
      <Target Name="CopyIBDStarterKitAssets" BeforeTargets="Build">
        <ItemGroup>
          <IBDStarterKitContentFiles Include="$(IBDStarterKitContentFilesPath)" />
        </ItemGroup>
        <Message Text="Copying IBDStarterKit files: $(IBDStarterKitContentFilesPath) - #@(IBDStarterKitContentFiles->Count()) files" Importance="high" />
        <Copy SourceFiles="@(IBDStarterKitContentFiles)" DestinationFiles="@(IBDStarterKitContentFiles->'$(MSBuildProjectDirectory)\App_Plugins\IBDStarterKit\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="false" />
      </Target>
    
      <Target Name="ClearIBDStarterKitAssets" BeforeTargets="Clean">
        <ItemGroup>
          <IBDStarterKitDir Include="$(MSBuildProjectDirectory)\App_Plugins\IBDStarterKit\" />
        </ItemGroup>
        <Message Text="Clear old IBDStarterKit data" Importance="high" />
        <RemoveDir Directories="@(IBDStarterKitDir)" />
      </Target>
    </Project>
    

    Any help would be appreciated.

  • Huw Reddick 1810 posts 6223 karma points MVP c-trib
    Jan 06, 2023 @ 07:41
    Huw Reddick
    0

    Hi Daniel,

    In the prj file try changing this

      <ItemGroup>
        <Content Include="App_Plugins\IBDStarterKit\**\*.*">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
        <None Include="buildTransitive\**" Pack="true" PackagePath="buildTransitive" />
      </ItemGroup>
    

    To the following (taken from my package project)

      <ItemGroup>
        <Content Include="App_Plugins\IBDStarterKit\**\*.*">
          <CopyToPublishDirectory>Always</CopyToPublishDirectory>
          <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
        </Content>
        <None Include="buildTransitive\**" Pack="true" PackagePath="buildTransitive" />
      </ItemGroup>
    
  • Daniel Rogers 134 posts 712 karma points
    Jan 06, 2023 @ 13:58
    Daniel Rogers
    0

    Thanks for you help Huw Reddick not sure if that was the solution because I also started ticking the version number over and things started happening.

    Got it copying the files from the package however I get this arrow on the folder / files in the solution explorer and I cannot edit them. And they dont copy to the bin/debug folder etc.

    solution explorer

    second issue it appears that some files re not being recognized even if I copy them over to the bin folder manually. As the dll is now working but the the lang en-US.xml file is not recognized to set the Section name correctly.

  • Huw Reddick 1810 posts 6223 karma points MVP c-trib
    Jan 06, 2023 @ 16:00
    Huw Reddick
    0

    IIRC the arrow indicates they are linked files rather than existing physically in the project, not sure why/how that has occured

    the file is located higher in the directory structure then the project file.

    You should not have to copy anything to the bin folder.

    Could you maybe provide an image of your full project structure?

    Just a thought but the Lang folder may be case sensitve so try changing it to lang instead.

  • Daniel Rogers 134 posts 712 karma points
    Jan 07, 2023 @ 00:39
    Daniel Rogers
    0

    tried changing lang to lowercase didnt help. Wouldnt expect it to as I said all works if I compile files direct inside a web project.

    Package project

    another observation is it normal for the nuget packege output in the web project to have a content Files node. all other packages dont. also it appears the package manifest is not being recognized. As the html views for the aplp_plugins are not recognizing the js controllers. However the html view is loaded.

    Website with package installed

  • Huw Reddick 1810 posts 6223 karma points MVP c-trib
    Jan 07, 2023 @ 08:07
    Huw Reddick
    0

    another observation is it normal for the nuget packege output in the web project to have a content Files node.

    No, that is not normal.

    I don't know if this will help at all, but I posted a blog on how I converted my Umbraco Forums package to use the new nuget way of doing it.

    https://umbraco.themediawizards.co.uk/the-grimoire/umbraco-10-razor-class-library-packages/

  • Daniel Rogers 134 posts 712 karma points
    Jan 18, 2023 @ 02:44
    Daniel Rogers
    0

    Hi Huw

    Seen as you were so helpful with this question you may be able to way in on taking this further in this question.

    https://our.umbraco.com/forum/using-umbraco-and-getting-started//110941-creating-packages-and-including-all-parts-of-project

    Thanks

  • Daniel Rogers 134 posts 712 karma points
    Jan 08, 2023 @ 13:23
    Daniel Rogers
    100

    Thanks Huw Reddick

    After much trial and error and study of Huw documentation.

    All ways not copying over as when the package compiles all the AppPlugins went to the "contents/AppPlugins/IBDStarterKit folder".

    worked this out by tracking down where all the packages are download to on the computer. "C:\Users[User Name].nuget\packages[package name][version]\contents\App_Plugins\IBDStarterKit"

    in the targets folder I changed this

      <PropertyGroup>
        <AppPluginsFilesPath> $(MSBuildThisFileDirectory)..\App_Plugins\IBDStarterKit\**\*.* </AppPluginsFilesPath>
      </PropertyGroup>
    

    to

      <PropertyGroup>
        <AppPluginsFilesPath> $(MSBuildThisFileDirectory)..\contents\App_Plugins\IBDStarterKit\**\*.* </AppPluginsFilesPath>
      </PropertyGroup>
    

    This now allowed the files to copy from the root AppPlugins folder to the bin/debug/net7.0/AppPlugins on running the application. And then be recognized in the back office.

    However more to learn.

    The IIRC the arrow indicates was still on the files. and the contents were still listed inside the dependencies/nuget package in the solution explorer.

    After studying Huw documentation I noticed I had this line missing

     <ContentTargetFolders>.</ContentTargetFolders>
    

    this solved all this inconsistences but ment the files went being loaded again. This line removed the contents folder form the nuget package in the solution explorer and also the content folder in the users package location.

    "C:\Users[User Name].nuget\packages[package name][version]\App_Plugins"

    returning the targets file back now allowed the files to appear in the project as they should with no IIRC the arrow indicates.

Please Sign in or register to post replies

Write your reply to:

Draft