question

ArberCeni-0176 avatar image
0 Votes"
ArberCeni-0176 asked

VSTOInstaller does not read app.config file during uninstall

Hello,

I have a document-level customization add-in which gets distributed through ClickOnce and references two libraries (among others). Those libraries reference two different versions of Newtonsoft.Json.dll so I have used bindingRedirect in app.config to solve the dependency mismatch. I also use Post Deployment Actions to set the customization URL and to create shortcuts.

Everything works fine during installation and the add-in works fine. The problems start when I want to uninstall the add-in. It gets removed from the Control Panel and no error is shown (nothing on EventViewer as well), but the installation files are still in the ClickOnce cache and the shortcuts do not get removed.

I suspected Post Deployment Actions code was not being called so I added a line of code to write a file in case it was called and this confirmed my suspicion: Post Deployment Action was not being called as nothing was written on that file during uninstall (but was written during install).

I then suspected that those libraries were the problem so I removed the reference to one of them and re-build the solution. This time everything worked fine.

I activated FusionLogs in the registry and noticed that during installation VSTOInstaller.exe was reading the app.config file from the add-in while during uninstall it was not. It tried to read VSTOInstaller.config and machine.config files from .NET Framework but not from the add-in. I added the bindingRedirect to VSTOInstaller.config and everything worked fine, so I am pretty sure the problem is that VSTOInstaller does not read the config file from the add-in during uninstall.

Below are the screenshots of the FusionLogs during Install and Uninstall:

During install:

88589-install.png

During uninstall:

88702-uninstall.png

The only solution I am left with is get the source code of those libraries, change them to use the same version of Newtonsoft.Json.dll and compile, but I don't like that solution as it becomes very hard to manage.

Do you have any suggestions?

Thank you in advance!

Arber


office-vsto-com-dev
install.png (50.1 KiB)
uninstall.png (82.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers