Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for How to debug an Office.js Manifest File
Matt Gaiser
Matt Gaiser

Posted on • Edited on

     

How to debug an Office.js Manifest File

For the past couple of weeks, I have been developing Microsoft Word Add-in's using theOffice.js framework, which lets you create web applications that can interact directly with any Microsoft Office application.

One of the tasks that has taken me the most time so far has been understanding and debugging themanifest.xml file, which is the file where UI components like labels and menus that integrate into the context menu (that box you get when you right-click) or the ribbon (the row of buttons at the top) are defined.

Debugging amanifest.xml file can mean two things. We will cover them both here.

1. Determining if it is valid XML for an Office Add-in

Microsoft provides a tool to check whether yourmanifest.xml is valid. You can read about it inmore detail here, but the basics are below.

If you used the Yeoman generator

If you used the Microsoft provided generator to set up the Office Add-in, it is as simple as running the command below:

npm run validate
Enter fullscreen modeExit fullscreen mode

If you did not use the Yeoman generator

You need to take the extra step of installingthe validation package first.

npm install -g office-addin-manifestnpm run validate
Enter fullscreen modeExit fullscreen mode

This step is well covered in the Microsoft documentation and is mostly here for completeness. But it does not actually report runtime errors, the kind of errors that otherwise silently occur and lead to menus, icons, and buttons not showing up.

2. Determining what errors might be causing it not to render properly

Unfortunately, when you Google for ways to debug the manifest file, it usually points you to theaforementioned validator, which is helpful but does not come close to solving actual bugs in the manifest that might cause your desired UI components to just not appear. It took me several days to figure out how you debug a syntactically correct but broken manifest file, which was a motivation for writing this post.

This debugging methof generates a runtime log for themanifest.xml of the errors that it encountered:

  1. Openthe Registry Editor on Windows. You can just search for it in the search bar and the logo looks like that.Alt Text
  2. Navigate toHKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Wef\Developer\.Alt Text
  3. Add a key calledRuntimeLogging toDeveloper. To do that, just right click on theDeveloper folder and chooseNew and thenKey.Alt Text
  4. Click onRuntimeLogging and then double click on (Default) in the box to the right.Alt Text
  5. Add the path to the .txt file where you want the log messages to be written. If you have not created a file for that, go and create one. That path should include the file name.Alt Text
  6. Run the Add-in however you normally would in your development environment. As far as I know, it requires no special flags or parameters in any configuration.
  7. After the Add-in has loaded in Office, you can check the designated file for any useful log messages.Alt Text

Happy debugging!

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp