Excel solver is broken with new add-in

Add-in Express™ Support Service
That's what is more important than anything else

Excel solver is broken with new add-in
 
nwein




Posts: 577
Joined: 2011-03-28
Dear addins,
I've received a complaint that after installing an addin (XLL + COM) which is distributed via ClickOnce deployment (right clicking the project and selecting Publish ADX project) the users get an error message when trying to execute the built in Excel Solver Add In.
the solver works fine, but when clicking the final Solve button, a run-time error '53': File not found Solver32.dll appears.
The solver32.dll is indeed available in its native C:\Program Files (x86)\Microsoft Office\Office14\Library\SOLVER folder

Someone was suggesting that this is because excel changes its working directory, or something of that sort when a ClickOnce and it's random file location is used for an Add-in.
I really have no clue, but was wondering if you know of any remedies for that.

Please note that this could be totally unrelated to the fact that my add-in is deployed as a ClickOnce Add-in, I'm just giving you more details.

Add-in Express 2010.6.4.3056 on Windows 7 64-bit, Office/Excel 2010 32-bit

Thanks
Posted 05 Jul, 2011 17:45:53 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello,

Does switching your add-in off and restarting Excel revives Solver?


Andrei Smolin
Add-in Express Team Leader
Posted 06 Jul, 2011 04:32:36 Top
nwein




Posts: 577
Joined: 2011-03-28
Switching off as in disabling it in the Add-In dialog doesn't fix it (disabling it in both the COM dialog and the Excel Add in dialog); it only works if I unregister my Addin.
Posted 06 Jul, 2011 17:40:35 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
I have no idea why this occur. I can install your add-in in the same environment. What do you think?


Andrei Smolin
Add-in Express Team Leader
Posted 07 Jul, 2011 01:45:47 Top
nwein




Posts: 577
Joined: 2011-03-28
Sorry, I was hasty in saying that it doesn't work when disabling the add-ins. It does work if I uncheck both COM and Excel Add-ins and then restart Excel.
But as soon as I enable either Add-ins the solver fails.
The Add-ins are registered from my VS location (/bin/debug), not the ClickOnce location, but it happens both to me and the users
Posted 07 Jul, 2011 10:43:48 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hi,

I can install your add-in (or any other add-in reproducing the same behavior) on my PC and check all necessary things. What do you think?


Andrei Smolin
Add-in Express Team Leader
Posted 08 Jul, 2011 03:35:27 Top
nwein




Posts: 577
Joined: 2011-03-28
I don't really know what to tell you...
Did you make sure you're clicking the Solve button in the end? Because the solver window will come up and will let me do everything in it, it's just the final Solve click that breaks it (when the solver can solve something, it works if there's no formulas in it - it just complains that there's nothing to solve).
Posted 08 Jul, 2011 17:51:28 Top
nwein




Posts: 577
Joined: 2011-03-28
I found the problem but now facing a new problem,
Everything evolves from the fact that I have an app.config in my solution (which uses RTD, XLL and COM addins in the same app domain), this apparently confuses Excel and is probably why the Solver is not loaded properly. Once I disable my config file from being copied to output directory it works fine.
But now, what am I supposed to do about the config file?
When building my addin dll it generates its myaddin.dll.config, but I can't read values from it using ConfigurationManager. The only way to get the values is to set the app.config to always copy to output but that apparently messes Excel's solver (and might mess other things?)

What is the approach to using configuration files for unified appdomain addins (or for addins in general)? I can see that the adxloader manifest specifies the name of the config file as app.config but not sure if it has anything to do with it.
Posted 09 Jul, 2011 22:14:02 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hi Nir,

You need to add a config file to your add-in project, mark it as "Copy always" or "Copy if newer" (see the Copy to Output Directory property) and makes sure that this file is mentioned in the adxloader.dll.manifest, see the configFileName attribute.


Andrei Smolin
Add-in Express Team Leader
Posted 11 Jul, 2011 04:04:29 Top
nwein




Posts: 577
Joined: 2011-03-28
I've just done so, though this come back to what I've described before - If I change the app.config in my Add-in project to Copy to Output Directory as 'Copy always' or 'Copy if newer' it breaks the Solver.
The default name in the manifest for the configFileName is App.config anyway (I've just renamed it to app.config hoping the lower case might make a difference but it didn't).
When changing the app.config property to Copy to output directory I'm ending up with two configurations: myaddin.dll.config and app.config (which is how any .NET application would behave) but I think the presence of the app.config messes Excel.
Posted 11 Jul, 2011 10:48:25 Top