Correct way to deploy changes to office add-in (not in the manifest file)

435 Views Asked by At

I have an Excel office add-in in app source.

I fixed a bug which a user has reported to me and now I want to deploy that fix.

This required a change in the .js files only, no change to the manifest file or any of the html pages for the taskpanes.

Updating the .js file on the server, even with caching disabled on the server endpoint won't trigger the add-in to reload the sources, they continue to be cached (from memory or from disk) according to the Edge DevTools debugger.

I have double checked that this file is different and, when I open the link in a browser and check the network tab in the web console I am getting a 200 response when I load it for the first time after updating, then 304 after that.

I can direct the user to reset the cache through file > options > trust center > trusted add-in catalogs > check the box that says "Next time Office starts, clear all previously-started web add-ins cache" > restart Excel > insert > my add-ins > add "the add-in", but this will only help one user, I want this to work for all users, obviously.

What am I missing here? Do I need to do something in app source? I can resubmit the add-in with an incremented version? But how long will that take for approval?

4

There are 4 best solutions below

1
On

Try renaming the file. Also, be sure to rename references to it, such as inside <script> tags. If you are using Webpack, it is easy to do all this automatically.

3
On

As it turned out, the problem was the wordpress fast cache plugin. This was disabled using htaccess on the server.

Now the request headers are coming through as:

cache-control: max-age=0, no-cache, no-store, must-revalidate,
...,
pragma: no-cache

I needed to reset the cache as mentioned above for this to take effect.

1
On

When you say you updated the .js file, did you change this in the src or the dist folder? May be a case of needing to rebuild the project ie npm run build?

0
On

Currently I am facing similar situation, and used renaming as suggested in answer above. I have written a script to rename files and there references in html/script files using them. below are simple steps I followed.

  1. Publish project with original file names.
  2. Generate a GUID, and rename all script files by adding it at end of filename.
  3. Iterate through all html/js files and search for script tags with source as old file name and replace it with new filename (originalname+GUID).