RE: [ExcelDna] FirstAddIn-packed.xll didn't work

387 views
Skip to first unread message

Govert van Drimmelen

unread,
Oct 17, 2012, 6:55:48 AM10/17/12
to exce...@googlegroups.com
Hi Soumya,

Yes - it all the libraries and dependencies are packed, you should only need to distribute the single packed .xll file.

I suggest you follow these steps:
1. make a clean directory with your all the files your add-in needs to run. Check that the add-in works from this directory.
2. Run the ExcelDnaPack, and check the output for any error. It will show you which files have been packed into the .xll file. Confirm that everything you expect has been packed, and there are no errors.
3. Copy the -packed.xll file to an empty directory, and try to open it.

If you're still stuck, it would help if you could post the output of ExcelDnaPack, and maybe explain what other libraries your add-in uses.

Regards,
Govert



From: exce...@googlegroups.com [exce...@googlegroups.com] on behalf of Soumya [soum...@algotree.com]
Sent: 17 October 2012 08:32 AM
To: exce...@googlegroups.com
Subject: [ExcelDna] FirstAddIn-packed.xll didn't work

         I understand FirstAddIn-packed.xll  is a single file add-in which can be renamed, distributed and run with no other files required.
Does it means a user only required this packed file to run the application ??

          I got its worked when
I created a new class library by following steps in a tutorial .But in  the existing project which  I renamed it doesnt work so I suspect I miss some configuration while renaming .

    Can any one help to solve this problem ??

Thanks
Soumya

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To view this discussion on the web visit https://groups.google.com/d/msg/exceldna/-/5W7cUTMeZkwJ.
To post to this group, send email to exce...@googlegroups.com.
To unsubscribe from this group, send email to exceldna+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/exceldna?hl=en.

Govert van Drimmelen

unread,
Oct 18, 2012, 5:44:50 AM10/18/12
to Excel-DNA
Hi Soumya,

You can retrieve the full path of the .xll like this:

string xllPath = (string)XlCall.Excel(XlCall.xlGetName);

From there you can then get the directory and load other files that
are placed next to the .xll.

Regards,
Govert


On Oct 18, 11:07 am, Soumya <soumy...@algotree.com> wrote:
> Hi Govert
>
>             I have some issues while packing . I used a separate file for
> configuration named config.properties . I use
> System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAsse mbly().CodeBase)..Replace("file:\\",
> ""); to get the config file path. It worked fine in add-in and all
> configurations are loaded . But while packing and tried I got the path as C:\Windows\Microsoft.Net
> \assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\config.properties
> and hence can't load the configurations !!!
>  I don't want to set the configurations in FirstAddIn.xll.config  . Is
> there any better way to read configurations from external file  ??
>
> On Wednesday, October 17, 2012 4:26:12 PM UTC+5:30, Govert van Drimmelen
> wrote:
>
>
>
>
>
>
>
>
>
> >  Hi Soumya,
>
> >  Yes - it all the libraries and dependencies are packed, you should only
> > need to distribute the single packed .xll file.
>
> >  I suggest you follow these steps:
> > 1. make a clean directory with your all the files your add-in needs to
> > run. Check that the add-in works from this directory.
> > 2. Run the ExcelDnaPack, and check the output for any error. It will show
> > you which files have been packed into the .xll file. Confirm that
> > everything you expect has been packed, and there are no errors.
> > 3. Copy the -packed.xll file to an empty directory, and try to open it.
>
> >  If you're still stuck, it would help if you could post the output of
> > ExcelDnaPack, and maybe explain what other libraries your add-in uses.
>
> >  Regards,
> > Govert
>
> >  ------------------------------
> > *From:* exce...@googlegroups.com <javascript:> [exce...@googlegroups.com<javascript:>]
> > on behalf of Soumya [soum...@algotree.com <javascript:>]
> > *Sent:* 17 October 2012 08:32 AM
> > *To:* exce...@googlegroups.com <javascript:>
> > *Subject:* [ExcelDna] FirstAddIn-packed.xll didn't work
>
> >           I understand FirstAddIn-packed.xll  is a single file add-in
> > which can be renamed, distributed and run with no other files required.
> > Does it means a user only required this packed file to run the application
> > ??
>
> >           I got its worked when I created a new class library by
> > following steps in a tutorial .But in  the existing project which  I
> > renamed it doesnt work so I suspect I miss some configuration while
> > renaming .
>
> >     Can any one help to solve this problem ??
>
> > Thanks
> > Soumya
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Excel-DNA" group.
> > To view this discussion on the web visit
> >https://groups.google.com/d/msg/exceldna/-/5W7cUTMeZkwJ.
> > To post to this group, send email to exce...@googlegroups.com<javascript:>
> > .
> > To unsubscribe from this group, send email to
> > exceldna+u...@googlegroups.com <javascript:>.

Govert van Drimmelen

unread,
Oct 18, 2012, 1:40:15 PM10/18/12
to Excel-DNA
Hi Soumya,

OK, these files are packed:
* FirstAddIn.dna
* FirstAddIn.xll.config
* AlgotreeExcel.dll

Does your add-in need any other files - like the config.properties
file you mentioned before?
If so, you'll need those files in addition to the -packed.xll file.

If your add-in runs fine in a directory with only these four files:
* FirstAddIn.xll
* FirstAddIn.dna
* FirstAddIn.xll.config
* AlgotreeExcel.dll

then I expect the -packed one to run fine too.

-Govert


On Oct 18, 12:56 pm, Soumya <soumy...@algotree.com> wrote:
> Hi Govert ,
>
>                The problem with config path solved .Thanks for your help
>
> I follow your steps for creating packed xll .But unfortunately its not
> working when packed.xll is copied  to new directory.
> No single function get  displayed in the packed xll while trying in empty
> directory .
> Output of EXCELDNA pack ishttps://gist.github.com/3910988
>
> Thanks
> Soumya
>
> On Thursday, October 18, 2012 3:15:01 PM UTC+5:30, Govert van Drimmelen

Govert van Drimmelen

unread,
Oct 19, 2012, 6:11:57 AM10/19/12
to Excel-DNA
Hi Soumya,

Other managed assemblies that you depend on can be added to the
packing by adding them with <Reference> tags in the .dna file:

<DnaLibrary>
<ExtenalLibrary Path="MyMainAddIn.dll" Pack="true">
<Reference Path="AdditionalDependency.dll" Pack="true">
<Reference Path="AnotherDependency.dll" Pack="true">
</DnaLibrary>

Then only "MyMainAddIn.dll" is inspected and registered with Excel,
but all three are packed and will be found at runtime.

You won't be able to use ExcelDnaPac to pack the config.properties
file - but you could add it as a resource to your own library and
process it yourself. The ExcelDnaPack only works with the
MyAddIn.xll.config file, which is automatically loaded as the
AppDomain configuration.

Regards,
Govert

On Oct 19, 10:49 am, Soumya <soumy...@algotree.com> wrote:
> Hi Govert ,
>
>              Yes I need some extra dll like Nest.dll and config.properties
> in the folder which contains packed.xll .
> But why the packed file doesn' t include the referenced dll in my project .
> Is there is a need to add External libraries via FirstAddIn.dna . When I
> add  <ExternalLibrary Path="Nest.dll" Pack="true" /> in FirstAddIn.dna I
> can't open the packed file.
>            Thanks for all your help
>
> Thanks
> Soumya
>
> On Thursday, October 18, 2012 11:10:23 PM UTC+5:30, Govert van Drimmelen
Reply all
Reply to author
Forward
0 new messages