OfficeDev / Office-Addin-Scripts

A set of scripts and packages that are consumed in Office add-ins projects.
MIT License
153 stars 93 forks source link

Side loading issue - Outlook (Test in Excel worked) #815

Closed cberane closed 8 months ago

cberane commented 8 months ago

Prerequisites

Expected behavior

The new add-in should be sideloaded as expected. If I remember correctly, this worked 2 weeks ago. Current tests led to the error described below.

Current behavior

Steps to Reproduce

My powershell input to create the new project:

PS C:\temp> npm -v
10.2.3
PS C:\temp> node -v
v18.17.0
PS C:\temp> npm install -g yo@latest generator-office@latest
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated readdir-scoped-modules@1.1.0: This functionality has been moved to @npmcli/fs
npm WARN deprecated debuglog@1.0.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs

changed 1204 packages in 38s

101 packages are looking for funding
  run `npm fund` for details

PS C:\temp> yo office

     _-----_     ╭──────────────────────────╮
    |       |    │   Welcome to the Office  │
    |--(o)--|    │   Add-in generator, by   │
   `---------´   │ @OfficeDev! Let's create │
    ( _´U`_ )    │    a project together!   │
    /___A___\   /╰──────────────────────────╯
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

? Choose a project type: Office Add-in Task Pane project
? Choose a script type: (Use arrow keys)
? Choose a script type: JavaScript
? What do you want to name your add-in? My Office Add-in
? Which Office client application would you like to support? Outlook

----------------------------------------------------------------------------------

      Creating My Office Add-in add-in for Outlook using JavaScript and Taskpane at C:\temp\My Office Add-in

----------------------------------------------------------------------------------

I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.

No change to package.json was detected. No package manager install will be executed.
npm WARN config cache-min This option has been deprecated in favor of `--prefer-offline`.
npm WARN deprecated debuglog@1.0.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated readdir-scoped-modules@1.1.0: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN deprecated @azure/msal-node@1.18.4: A newer major version of this library is available. Please upgrade to the latest available version.
npm WARN deprecated @azure/msal-browser@2.38.3: A newer major version of this library is available. Please upgrade to the latest available version.

added 1354 packages, and audited 1355 packages in 20s

180 packages are looking for funding
  run `npm fund` for details

10 moderate severity vulnerabilities

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
----------------------------------------------------------------------------------------------------------

      Congratulations! Your add-in has been created! Your next steps:

      1. Go the directory where your project was created:

         cd "C:\temp\My Office Add-in"

      2. Start the local web server and sideload the add-in:

         npm start

      3. Open the project in VS Code:

         code .

         For more information, visit http://code.visualstudio.com.

      Please visit https://learn.microsoft.com/office/dev/add-ins for more information about Office Add-ins.

      Please visit https://learn.microsoft.com/office/dev/add-ins/outlook/sideload-outlook-add-ins-for-testing for more information about Outlook sideloading.

----------------------------------------------------------------------------------------------------------

image

Then in an administrative powershell:

PS C:\temp\My Office Add-in> npm start

> office-addin-taskpane-js@0.0.1 start
> office-addin-debugging start manifest.xml

Debugging is being started...
App type: desktop
Enabled debugging for add-in a8c09b41-7889-4b9f-8867-ff20045d72d2.
The dev server is already running on port 3000.
Sideloading the Office Add-in...
running: npx -p @microsoft/teamsfx-cli@2.0.3-alpha.e5db52f29.0 teamsfx m365 sideloading --xml-path C:\temp\My Office Add-in\manifest.xml

Warning: We are planning to depreate 'teamsfx' as command signagure and move to 'teamsapp' instead in the next major version of Teams Toolkit CLI.

Successfully registered package! (??)
 STDERR: (×) Error: TeamsfxCLI.UnknownCommandError: 'Office' is misspelled or not recognized by Teams Toolkit CLI. Use 'teamsfx m365 sideloading -h' for more command information.

Error: Unable to start debugging.
Error: Unable to sideload the Office Add-in.
Error: Unable to set registry value "a8c09b41-7889-4b9f-8867-ff20045d72d2" to "C:\temp\My Office Add-in\manifest.xml" (REG_SZ) for key ""HKCU\SOFTWARE\Microsoft\Office\16.0\Wef\Developer"".
ProcessUncleanExitError: ADD command exited with code 1:

ERROR: Invalid syntax.
Type "REG ADD /?" for usage.
PS C:\temp\My Office Add-in>

image

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Failure Logs

Included in the logs and screenshot above.

cberane commented 8 months ago

Here the example for an excel addin:

PS C:\WINDOWS\system32> cd C:\temp\
PS C:\temp> yo office

     _-----_     ╭──────────────────────────╮
    |       |    │   Welcome to the Office  │
    |--(o)--|    │   Add-in generator, by   │
   `---------´   │ @OfficeDev! Let's create │
    ( _´U`_ )    │    a project together!   │
    /___A___\   /╰──────────────────────────╯
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

? Choose a project type: Office Add-in Task Pane project
? Choose a script type: (Use arrow keys)
? Choose a script type: JavaScript
? What do you want to name your add-in? excel-test
? Which Office client application would you like to support? Excel

----------------------------------------------------------------------------------

      Creating excel-test add-in for Excel using JavaScript and Taskpane at C:\temp\excel-test

----------------------------------------------------------------------------------

I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.

No change to package.json was detected. No package manager install will be executed.
npm WARN config cache-min This option has been deprecated in favor of `--prefer-offline`.
npm WARN deprecated debuglog@1.0.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated readdir-scoped-modules@1.1.0: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN deprecated @azure/msal-node@1.18.4: A newer major version of this library is available. Please upgrade to the latest available version.
npm WARN deprecated @azure/msal-browser@2.38.3: A newer major version of this library is available. Please upgrade to the latest available version.

added 1354 packages, and audited 1355 packages in 22s

180 packages are looking for funding
  run `npm fund` for details

10 moderate severity vulnerabilities

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
----------------------------------------------------------------------------------------------------------

      Congratulations! Your add-in has been created! Your next steps:

      1. Go the directory where your project was created:

         cd C:\temp\excel-test

      2. Start the local web server and sideload the add-in:

         npm start

      3. Open the project in VS Code:

         code .

         For more information, visit http://code.visualstudio.com.

      Please visit https://learn.microsoft.com/office/dev/add-ins for more information about Office Add-ins.

----------------------------------------------------------------------------------------------------------

PS C:\temp> cd .\excel-test\
PS C:\temp\excel-test> npm start

> office-addin-taskpane-js@0.0.1 start
> office-addin-debugging start manifest.xml

Debugging is being started...
App type: desktop
Enabled debugging for add-in 4d844fa2-7d23-4a18-a362-10081b3118e7.
The dev server is already running on port 3000.
Sideloading the Office Add-in...
Launching excel via C:\Users\.....\AppData\Local\Temp\Excel add-in 4d844fa2-7d23-4a18-a362-10081b3118e7.xlsx
Debugging started.
cberane commented 8 months ago

Fun fact: The script seems to miss to add quotation marks to get a valid --xml-path to load the manifest.xml

C:\temp\my-office-addin>npm run start

> office-addin-taskpane-js@0.0.1 start
> office-addin-debugging start manifest.xml

Debugging is being started...
App type: desktop
Enabled debugging for add-in a8c09b41-7889-4b9f-8867-ff20045d72d2.
The dev server is already running on port 3000.
Sideloading the Office Add-in...
running: npx -p @microsoft/teamsfx-cli@2.0.3-alpha.e5db52f29.0 teamsfx m365 sideloading --xml-path C:\temp\my-office-addin\manifest.xml

Warning: We are planning to depreate 'teamsfx' as command signagure and move to 'teamsapp' instead in the next major version of Teams Toolkit CLI.
This command is in preview.
Using account xxx@xxx
TitleId: U_ac8fcbc8-cdd8-541d-050d-0555c497236c
AppId: a8c09b41-7889-4b9f-8867-ff20045d72d2
Sideloading done.

Successfully registered package! (U_ac8fcbc8-cdd8-541d-050d-0555c497236c)
 STDERR:

Launching outlook via C:\Program Files\Microsoft Office\Root\Office16\OUTLOOK.EXE
Debugging started.
millerds commented 8 months ago

Thanks for pointing that out. The Outlook sideload method was recently updated and it looks like that was missed. Will fix that quickly.

millerds commented 7 months ago

That should be fixed in the most recent version of the tooling. Make sure your project is installing the latest office-addin-debugging package and it should be correct.