generator-spfx icon indicating copy to clipboard operation
generator-spfx copied to clipboard

As of 1.12.1, gulp ship script can produce an sppkg with 2 manifests, preventing deployment in AppCatalog

Open gitbrent opened this issue 3 years ago • 3 comments

General Information

  • [ ] Usage
  • [X] Development
  • [ ] Documentation
  • [ ] Feature Request

Specific generator

  • [ ] Addons
  • [ ] HandlebarsJS

What Version you are running?

Describe your problem

What

Invalid sppkg applications will be produced by the updated build process introduced in 1.12.1 when more than one manifest file exists in the release directory.

When

This issue has appeared with the upgrade to the recent 1.12.1 release which uses an updated build process, which includes use of a new release directory.

How

Some developers such as myself build more than one package from our projects. In my case, I have comments in config/package-solution.json and src/*.manifest.json that I comment/uncomment depending whether i'm building for DEV or PROD.

E.g:

//"id": "2a415ba8-ae1a-4ad3-92e8-0c63835c1610", // DEV
"id": "2a415ba8-ae1a-4ad3-92e8-0c63835c1611", // PROD

This has never been an issue until recently and this method of producing 2 versions of an SPFx app has been reviewed and deemed correct by Vesa previously.

Why

When an app is built now, it produces a manifest file under ./release/manifests like [GUID].manifest.json which is then bunded and included in the the sppkg under ./sharepoint/solution.

This issue presents itself when subsequently building another release (say I built "DEV" and then "PROD"). Now there are TWO manifest files under ./release/manifests and they are both included in the sppkg app and both are referenced in the AppManifest.xml.rels file.

Example:

<?xml version="1.0" encoding="utf-8"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
	<Relationship Type="http://schemas.microsoft.com/sharepoint/2012/app/relationships/manifest-feature" Target="/feature_2a415ba8-ae1a-4ad3-92e8-0c63835c1610.xml" Id="r10"></Relationship>
	<Relationship Type="http://schemas.microsoft.com/sharepoint/2012/app/relationships/manifest-feature" Target="/feature_2a415ba8-ae1a-4ad3-92e8-0c63835c1611.xml" Id="r11"></Relationship>
	<Relationship Type="http://schemas.microsoft.com/sharepoint/2012/app/relationships/manifest-clientsideasset" Target="/ClientSideAssets.xml" Id="r12"></Relationship>
</Relationships>

Summary

The sppkg product will show an "component ID {0} exists in solution {1} already" error in the AppCatalog when uploaded as the duplicitous manifest ID is already in use by another app pkg.

Request

Please add the removal of any old manifest files to the gulp clean script.

For any other users encountering this issue: I'm using this as a workaround:

// package.json
  "scripts": {
    "ship": "rm -r release && gulp clean --ship && gulp bundle --ship && gulp package-solution --ship",
  },

gitbrent avatar May 19 '21 20:05 gitbrent

generator-spfx does not support 1.12.1.

StfBauer avatar May 21 '21 08:05 StfBauer

@StfBauer when it will support 1.12.1?

nsksaisaravana avatar Aug 24 '21 05:08 nsksaisaravana

Sadly haven't time to upgrade - Will be complicated because of different gulp variants for different projects.

StfBauer avatar Aug 26 '21 09:08 StfBauer