step‐by‐step guide to creating and distributing a package in Umbraco 8 - FadiZahhar/umbraco8showandtell GitHub Wiki

🧰 Prerequisites

Ensure you have:

  • An Umbraco 8 project set up and running.
  • Access to the project's file system and the Umbraco backoffice.
  • Basic knowledge of Umbraco's structure and components.

📦 Step 1: Create a Package in the Backoffice

  1. Log in to the Umbraco backoffice.

  2. Navigate to the Packages section.

  3. Click on Created in the top-right corner.

  4. Click the Create package button.

  5. Fill in the package details:

    • Name: e.g., Custom Welcome Dashboard.
    • Version, Author, License, etc.
  6. Under Package Contents, select the items you want to include:

    • Document Types, Data Types, Templates, Stylesheets, Scripts, Partial Views, etc.
  7. Click Create to generate the package schema.

  8. Click Download to download the package as a .zip file.([docs.umbraco.com][1], [docs.umbraco.com][2])


🗂️ Step 2: Inspect the Package ZIP

The downloaded .zip file contains:

You can inspect and modify the package.xml if needed to fine-tune the package contents.


🛠️ Step 3: Create a NuGet Package (Optional)

For broader distribution, especially if you plan to share your package via NuGet, follow these steps:([Umbraco][3])

  1. Set Up a Class Library Project:

    • In Visual Studio, create a new Class Library (.NET Framework) project.
    • Add your custom code, views, and other assets to this project.([codeshare.co.uk][4], [Stack Overflow][5])
  2. Organize the App_Plugins Folder:

    • Create an App_Plugins folder in your project.
    • Place your package's files (e.g., package.manifest, views, scripts) inside App_Plugins/YourPackageName/.
  3. Edit the .csproj File:

    • Include the following properties within the <PropertyGroup>:([docs.umbraco.com][1])

      <PackageId>YourPackageName</PackageId>
      <Version>1.0.0</Version>
      <Authors>Your Name</Authors>
      <Company>Your Company</Company>
      <Description>Your package description.</Description>
      <PackageLicenseExpression>MIT</PackageLicenseExpression>
      <PackageProjectUrl>https://yourprojecturl.com</PackageProjectUrl>
      <RepositoryUrl>https://github.com/yourrepo</RepositoryUrl>
      <RepositoryType>git</RepositoryType>
    • Ensure that the App_Plugins folder is included in the package by adding:([docs.umbraco.com][2])

      <ItemGroup>
        <Content Include="App_Plugins\**\*.*" Pack="true" PackagePath="contentFiles\any\any\App_Plugins\" />
      </ItemGroup>
  4. Build the NuGet Package:

    • Open the command prompt and navigate to your project directory.

    • Run:([Umbraco][6])

      nuget pack YourProject.csproj
    • This will generate a .nupkg file in the output directory.


🚀 Step 4: Distribute Your Package

  • Via Umbraco Package Repository:

  • Via NuGet:

    • Create an account on [NuGet.org](https://www.nuget.org/).
    • Upload your .nupkg file.
    • Once published, others can install your package using NuGet Package Manager.

🧪 Step 5: Test Your Package

Before distributing, test your package to ensure it installs and functions correctly:

  1. Install the Package:

    • In a fresh Umbraco 8 project, install your package via the backoffice or NuGet.([docs.umbraco.com][2])
  2. Verify Functionality:

    • Check that all included components (e.g., document types, templates, dashboards) are present and working as expected.
  3. Check for Errors:

    • Monitor the logs for any installation errors or issues.
⚠️ **GitHub.com Fallback** ⚠️