Automatic Update (Excel-DNA) XLL with Excel Open

I am developing an Excel XLL add-in using Excel-DNA and C #. The add-in is called MyAddIn.xll. The add-in was saved on the user's local computers, and it was installed / added to Excel by the following procedure:

Excel options -> Add-ons -> Manage Excel Add-ons -> and add MyAddIn.xll.

Now I want to release the MyAddIn.xll update to all my users. I am using a deployment tool such as Salt. However, this seems to require Excel to be closed on users' computers.

Is there a way that I can push the new xll to users machines when they open Excel and allow the change when restarting Excel?

Thank!

+4
source share
1 answer

The .xll file will always be locked by Excel, so you cannot update this file while loading the add-in. You may be able to structure your add-on so that the .xll does not change with updates, but the .dll files that you use change.

There are two approaches to supporting Excel-DNA:

  • .Dna files can be redirected to subdirectories, and your root .dna file can be updated when the add-in loads. So you can:

    • \ AddInRoot \ MyAddIn.xll
    • \ AddInRoot \ MyAddIn.dna
    • \ AddInRoot \ Version1 \ MyAddInImpl.dna
    • \ AddInRoot \ Version1 \ MyAddInImpl.dll
    • \ AddInRoot \ Version2 \ MyAddInImpl.dna
    • \ AddInRoot \ Version2 \ MyAddInImpl.dll

    And in MyAddIn.dna you have <DnaLibrary ...> <ExternalLibrary Path="Version1\MyAddInImpl.dna" /> </DnaLibrary>

    While the add-in is loading, you can replace MyAddIn.dna with a new version that references the new Version2 directory.

  • Excel-DNA DLL .dll. , : <DnaLibrary ...> <ExternalLibrary Path="MyFunctions.dll" LoadFromBytes="true" /> </DnaLibrary>

    MyFunctions.dll .

Excel , File- > Open.xll , ( xlfRegister Application.RegisterXLL ).

+7

Source: https://habr.com/ru/post/1589185/


All Articles