WhatsForm native Word add-in (VSTO) — build, install, uninstall
=================================================================

THIS IS DIFFERENT FROM THE deploy\ FOLDER AT THE REPO ROOT
  That one installs the existing Office.js add-in (Word/Excel/PowerPoint,
  loads from the web, no build step). This one installs the NEW native
  Word-only VSTO add-in, and — unlike the Office.js edition — it must be
  BUILT before it can be installed. There is no way around that: a VSTO
  add-in's deployment manifest (the .vsto file the installer registers) is
  generated by Visual Studio itself; nothing here can produce it for you.

WHAT YOU NEED TO BUILD IT
  - Visual Studio 2022 with the "Office/SharePoint development" workload
    (Visual Studio Installer -> Modify -> add that workload) and the
    .NET Framework 4.8 targeting pack (Individual Components tab)
  - Microsoft Word (desktop) installed on the same machine
  - The WebView2 Runtime (present by default on most current Windows
    10/11 machines) — Word will show a blank/error task pane without it,
    not fail to load the add-in itself

BUILD
  1. Open ..\WhatsForm.Office.sln in Visual Studio.
  2. Let NuGet restore (Microsoft.Web.WebView2, Newtonsoft.Json).
  3. Right-click WhatsForm.Word.VSTO -> Set as Startup Project.
  4. Build (Ctrl+Shift+B). For anything beyond your own machine, switch the
     configuration dropdown to Release first — a Debug build works but
     isn't meant to be handed to anyone else.
  5. Confirm bin\Release\WhatsForm.Word.VSTO.vsto now exists next to the
     compiled WhatsForm.Word.VSTO.dll. That .vsto file is what the
     installer below actually registers.

  (Pressing F5 instead of just Build also works for your own testing —
  Visual Studio sideloads the add-in into Word automatically while
  debugging. The installer below is for when you want it to keep loading
  after you close Visual Studio, without needing F5 every time.)

INSTALL
  1. Make sure you've built at least once (see above).
  2. Close Word completely.
  3. Double-click  "Install WhatsForm Word VSTO Add-in.cmd"
     If Windows shows a blue "Windows protected your PC" box (this add-in
     isn't code-signed yet — see LIMITATIONS below), click "More info"
     then "Run anyway".
  4. Open Word. The WhatsForm ribbon tab should appear.

  No administrator rights needed — this registers the add-in for your
  Windows user account only (HKEY_CURRENT_USER), the same no-admin
  approach the Office.js edition's installer uses.

  Built somewhere other than bin\Release (e.g. you used Visual Studio's
  "Publish" instead of a plain Build)? Run the PowerShell script directly
  with a path:
    powershell -File install-whatsform-word-vsto.ps1 -BuildOutputPath "C:\path\to\your\build"

IF THE RIBBON TAB DOESN'T APPEAR
  Word disables an add-in automatically after a few failed load attempts
  (common while you're still actively developing it) and won't retry on
  its own. Check File > Options > Add-ins — look under "Disabled
  Application Add-ins" in the dropdown at the bottom, and re-enable
  WhatsForm there if it's listed. Re-running the installer does not fix
  this by itself; Word has to be told to stop ignoring it.

UPDATES
  Re-build (Release) in Visual Studio, then re-run the installer — it
  overwrites the same registry entry, so there's nothing to remove first.
  The web app the task pane loads (WebAppUrl in appsettings.json) updates
  itself independently, same as the Office.js edition — only the native
  shell (ribbon, bridge commands, Word events) needs a rebuild+reinstall.

REMOVE
  Close Word, then double-click  "Uninstall WhatsForm Word VSTO Add-in.cmd"
  This only removes the registry registration — it does not delete your
  build output or touch anything under %LOCALAPPDATA%\WhatsForm\ (the
  WebView2 profile folder — see WebView2HostControl.cs). Delete those
  yourself if you want a completely clean slate.

LIMITATIONS OF THIS INSTALLER (read before shipping this to anyone else)
  This is a per-user registry registration script, not a real installer
  package. It deliberately does NOT:
    - Check for or install prerequisites (.NET Framework 4.8, the VSTO
      2010 Runtime, the WebView2 Runtime) before registering — if any of
      those are missing, Word will fail to load the add-in with a fairly
      unhelpful error, not a clear "please install X first" message.
    - Sign the assembly/manifest, so Windows SmartScreen and Word's own
      trust prompts will warn on first run (see INSTALL step 3).
    - Support per-machine (all-users) install, silent/unattended install,
      or any enterprise deployment mechanism (Group Policy, Intune, etc.).
    - Provide a rollback/previous-version mechanism — "update" is just
      "overwrite and reinstall".
  Building a real MSI (prerequisite bootstrapping, code signing, per-
  machine install, enterprise deployment guidance) is tracked as
  follow-on work — see ../../VSTO_HYBRID_IMPLEMENTATION_PLAN.md's
  "Follow-on phases" section. This script is deliberately the smaller,
  honest first half of Phase 15 — good enough to install/uninstall on
  your own development machine, not to hand to a customer.
