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

Manifest generated is invalid due to not creating a random GUID for the Id

Open emmasab opened this issue 1 year ago • 6 comments

Expected behavior

Run yo office

Select the following

  • ? Choose a project type: Office Add-in Task Pane project
  • ? Choose a script type: JavaScript
  • ? What do you want to name your add-in? Test Add-In
  • ? Which Office client application would you like to support? Excel

The manifest.xml produced contains a randomly generated GUID in the <id><\id> tag

Current behavior

The manifest.xml produced contains <Id>Add-In</Id> instead

Running npm run validate confirms the manifest is invalid

Error OfficeDev/generator-office#1:
XML Schema Validation Error: Error found during XML Schema validation.
  - Details: The 'http://schemas.microsoft.com/office/appforoffice/1.1:Id' element is invalid - The value 'Add-In' is invalid according to its datatype 'http://schemas.microsoft.com/office/appforoffice/1.1:UUID' - The Pattern constraint failed.
  - Line: 3
  - Column: 4

Error OfficeDev/generator-office#2:
XML Schema Violation: Your manifest does not adhere to the current set of XML schema definitions for Office Add-in manifests.

Error OfficeDev/generator-office#3:
Manifest product ID Not Valid: The manifest product ID could not be parsed. The ID must be a plain GUID.
  - Details: Add-In

The manifest is not valid.

emmasab avatar Apr 24 '24 23:04 emmasab

@millerds I can reproduce. If the user gives a name with a space in it, the first word is put into the <DisplayName> element and the second word into the <Id> element.

This affects all project types except the manifest-only type.

I never use spaces in my project names, so I don't know how long it's been like this, but I think we'd have seen customer complaints if it had been very long.

Rick-Kirkham avatar Apr 24 '24 23:04 Rick-Kirkham

I think this is a result of our moving the manifest update from generator-office to the convert script. You and repro this by running "npm run convert-to-single-host excel xml my add-in" in the template repo. The convert script line near the end that set's the cmdLine value needs to include quotes around the argument for the project name.

millerds avatar Apr 24 '24 23:04 millerds

@millerds I think the damage is done before then. At the top where name and id are consecutive arguments:

const projectName = process.argv[4];  // = "my"
let appId = process.argv[5];          // = "add-in"

I think the generator has to put the display name in quotation marks. Then the line that sets the cmdline value doesn't need to change. If that seems right to you, should this move back to the generator repo?

Rick-Kirkham avatar Apr 25 '24 00:04 Rick-Kirkham

@Rick-Kirkham Actually . . . I'm thinking now that it needs to be done in both places. They are both doing the same thing . . . that is taking a string argument and plugging it into another string that will be used as a cli command where any unquoted spaces get interpreted as argument separators. The symptoms reported here are based on the generator-office problem, but once that is fixed the project will be generated with a correct GUID, but the name will only be the first word instead of the whole thing.

I'll move this back because of the symptoms reported, but you'll need another issue for the templates for the fix there as well.

millerds avatar Apr 25 '24 17:04 millerds

Fix is checked into the repo. Need change to taskpane repo in order to be effective. Will publish the generator-office change soon.

millerds avatar Apr 25 '24 20:04 millerds

Change to conversion script is in 258.

Rick-Kirkham avatar Apr 25 '24 22:04 Rick-Kirkham

Fix to generator-office has been published. Please update and it should work now.

millerds avatar May 06 '24 18:05 millerds