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 ).