Avoiding deployment validation errors with SPFx packages

package-solution.json fileJust a quick note on a gotcha I came across when deploying an SPFx package to the App Catalog:

In the package-solution.json file, make sure your solution name doesn't use dot notation (or for my American friends, doesn't contain periods). This appears to prevent SharePoint from recognising your .sppkg file as a valid app package.



I started with a package-solution.json file that resembled the following - a nicely-qualified solution name, or so I thought:

{
    "solution": {
        "name": "Chorus.TiledNewsPart",
        "id": "83a75dd2-26d3-4235-b4ba-d0d4a8b19443",
        "version": "1.0.0.2"
    },
    "paths": {
        "zippedPackage": "solution/chorustilednewspart.sppkg"
    }
}


When I dropped the package into the App Catalog, I saw the following:










As you can see, things don't look good:

  • A bunch of fields (Title, Product ID, Metadata Language) haven't been populated.
  • The Valid App Package field value is No.
  • The Deployed field value is No.

Needless to say, my web part didn't make it through to any of my SharePoint sites either.

If we switch to a more NPM-style naming convention for my solution name in the package-solution.json file (use dashes, ditch the dots):

{
    "solution": {
        "name": "chorus-tiled-news-part", 
        "id": "83a75dd2-26d3-4235-b4ba-d0d4a8b19443", 
        "version": "1.0.0.3" 
    }, 
    "paths": { 
        "zippedPackage": "solution/chorustilednewspart.sppkg" 
    }
}

We now get a much better result when we add the package to the App Catalog - all fields are populated, the Valid App Package field value is Yes, and the Deployed field value is Yes:












And there you have it. Summary: dots bad, dashes good.

Comments

Popular posts from this blog

Server-side activities have been updated

The target principal name is incorrect. Cannot generate SSPI context.

Custom Workflow Activity for Creating a SharePoint Site