[ExcelDna] Does ExcelDna work with .net 4 / VS2010?

372 views
Skip to first unread message

SFun28

unread,
Apr 26, 2010, 8:39:41 PM4/26/10
to ExcelDna
Hi Govert,

I'm re-writing an existing ExcelDna-based library. The old version
compiles an external library in .net 3.5 using VS2008. The new
version is 4.0 with VS 2010. I've renamed some functions and moved/
changed some namespaces. Other than that I'm following all of the
rules to reference an external library. I can't see my UDFs in Excel
with the new version. Both use the latest ExcelDna .25. I've tried
for a couple of days now to debug this, but I'm not getting anywhere.
I've tried to use the same xll/dna name as the old version as well as
a new name.

Here's one thing that's peculiar: When I load the old version I cannot
delete the files until Excel is closed (makes sense, since the XLL is
in use). With the new version I can delete the files just fine. So
it seems that Excel isn't even loading the Xll.

Can you provide some guidance?

Best,
Suraj

--
You received this message because you are subscribed to the Google Groups "ExcelDna" group.
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,
Apr 28, 2010, 11:02:32 AM4/28/10
to ExcelDna
Hi Suraj,

Support for VS 2010 and .Net 4 are separate issues.

ExcelDna currently supports only the .Net 2.0 runtime (which is the
most recent runtime before .Net 4 since .Net 3.0 and 3.5 were only
additional sets of libraries running on the same .Net 2.0 runtime). If
you can recompile your new library to target the .Net 2.0 runtime,
that should work immediately. I presume your .Net 4 library is not
loaded because the .Net runtime fails to load the library.

Support for .Net 4 in ExcelDna is very attractive and planned. But it
is not quite trivial if I'd like to keep the current support for .Net
2.0 and come up with a reasonable way to handle the initial loading
for all cases.
If you really have to get .Net 4 working urgently, you can contact me
directly to try a few things, but I'd rather you wait a bit.

As for VS 2010:
ExcelDna recompiles fine in VS 2010 after conversion and seems to work
exactly as before. (Please report any problems you run into after
compiling with VS 2010.)
However, I have run into the same problem you have, which is that
debugging seems problematic. If you set a breakpoint in your managed
code, and then run Excel.exe as the 'start external' program, your
code runs but the breakpoint is not hit.
I think this is a bug in the mixed debugging mode of VS 2010 - they
expect the mixed code to be native + .Net 4, and for ExcelDna at the
moment you need native + .Net 2.0.

This is not an ExcelDna isuue, but looks like a bug in VS 2010. The
Microsoft Connect case for the bug is here: Connect ID 554067 -
entitled "Cannot debug .NET 2.0/3.0/3.5 code using F5 in mixed mode
from native c++ projects or c# project with 'start external program'
set to native .exe"
https://connect.microsoft.com/VisualStudio/feedback/details/554067/cannot-debug-net-2-0-3-0-3-5-code-using-f5-in-mixed-mode-from-native-c-projects-or-c-project-with-start-external-program-set-to-native-exe

A workaround is to attach to a running instance of Excel.exe. You can
then pick the right debugging environment, and everything works fine.
What I've been doing is to call Debug.Fail(..) in my managed code, and
then run Excel from outside. When the Debug.Fail is hit, I can choose
to Debug with my VS session and everything is fine.


In terms of my priorities for ExcelDna:
- If there are any problems with Excel 2010 this will be my top
priority, but so far ExcelDna seems to work fine for me on Excel 2010.
- I'm trying to get some basic support in place for the Excel
2007/2010 Ribbon next.
- Then I'll have a look at .Net 4.
- Support for 64-bit support is very unlikely to come this year.


I'd welcome any feedback on what you'd like the priorities to be.


Regards,
Govert

SFun28

unread,
Apr 28, 2010, 1:40:18 PM4/28/10
to ExcelDna
Hello Govert,

Many thanks for this detailed response! As always you are organized,
thorough, and transparent and I appreciate it. Neither .net 4 nor
VS2010 are urgent. They are both nice-to-haves but, in my opinion,
lower priority than the items you listed (Excel 2010, 64-bit, etc.)

Thanks so much for giving me insight into your priorities. Here's my
opinion (for what its worth):
- I completely agree with your top-priority to support Excel 2010. I
think many developers are eager to use and deploy Excel 2010. If 2007
was a stepping-stone/paradigm-shift for Excel, then 2010 makes it
legitimate. =)
- I think developers would be evenly divided between Ribbon versus 64-
bit. Ribbon completes the Excel 2007 story. 64-bit adds massive
capabilities and enables previously unfeasible computation scenarios.
I would vote for 64-bit. Here's a few reasons: ExcelDna already
provides a solution to surface UDFs/Macros, whereas 64-bit has no
coverage at all. Excel 2010 64-bit IS now part of the product set.
ExcelDna cannot say that its Excel 2010 compatible and not support 64-
bit, whereas not supporting Ribbon just means that certain scenarios
are prioritized over other. Another way to look at this: 64-bit is
NOT a scenario, its the product.
- I would place .net 4 at the bottom of the list. The value-add seems
small compared to Ribbon/64-bit. The new framework features are nice,
but honestly I don't think people are calling WCF-enabled workflows
from their Excel add-ins =)

hope this helps,
Suraj
> set to native .exe"https://connect.microsoft.com/VisualStudio/feedback/details/554067/ca...

Govert van Drimmelen

unread,
Apr 30, 2010, 9:36:18 AM4/30/10
to ExcelDna
Hi Suraj,

I quick update for a workaround to the VS2010 debugging issue.

If you add an excel.exe.config file with the supportedRuntime entry,
the debugger should work right:
The exel.exe.config file should be placed next to your exel.exe, and
contain:

<?xml version ="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" />
</startup>
</configuration>

Note that the .config file is not needed for ExcelDna add-ins to work
normally, just for the mixed debugging in VS2010 to start with the
right settings.

Regards,
Govert

Mathias Brandewinder

unread,
Jun 2, 2010, 7:35:49 PM6/2/10
to Excel-Dna
> - I would place .net 4 at the bottom of the list.  The value-add seems
> small compared to Ribbon/64-bit.  The new framework features are nice,
> but honestly I don't think people are calling WCF-enabled workflows
> from their Excel add-ins =)

I don't care about WCF either, but on the other hand, I would LOVE to
be able to call the Tasks Parallel Library, which is awesome for
parallel computing...

Govert van Drimmelen

unread,
Jun 3, 2010, 3:57:44 AM6/3/10
to Excel-Dna
Hi Mathias,

With the Ribbon and RTD support now released, I'm hoping to get some
feedback on whether those features works OK, need to test a bit more
under Excel 2010, and then get some Introduction / Getting Started
page for the hat together.
I think .Net 4 will be the next priority on my list - hopefully around
August/September.

Note that the Task Parallel Library is available for .Net 3.5 SP1 as
part of the Reactive Extensions library:
http://msdn.microsoft.com/en-us/devlabs/ee794896.aspx. This should
work fine with Excel-Dna, and even from .dna files using the recent
CompilerVersion attribute (although I haven't tried it myself).

If that version works for you, we'd love to see some examples posted
of your using it with Excel !!

Regards,
Govert

On Jun 3, 1:35 am, Mathias Brandewinder

Mathias Brandewinder

unread,
Jun 6, 2010, 10:32:37 PM6/6/10
to Excel-Dna
Very cool, thanks for pointing out that the TPL doesn't require .Net
4.0, I didn't realize that and will try it out! I am actually writing
a post around this, and will let you know when it's out.
I am having a lot of fun with Excel DNA so far, it's a very cool
project.

On Jun 3, 12:57 am, Govert van Drimmelen <gov...@icon.co.za> wrote:
> Hi Mathias,
>
> With the Ribbon and RTD support now released, I'm hoping to get some
> feedback on whether those features works OK, need to test a bit more
> under Excel 2010, and then get some Introduction / Getting Started
> page for the hat together.
> I think .Net4 will be the next priority on my list - hopefully around
> August/September.
>
> Note that the Task Parallel Library is available for .Net3.5 SP1 as
> part of the Reactive Extensions library:http://msdn.microsoft.com/en-us/devlabs/ee794896.aspx. This should
> work fine with Excel-Dna, and even from .dna files using the recent
> CompilerVersion attribute (although I haven't tried it myself).
>
> If that version works for you, we'd love to see some examples posted
> of your using it with Excel !!
>
> Regards,
> Govert
>
> On Jun 3, 1:35 am, Mathias Brandewinder
>
>
>
> <mathias.brandewin...@gmail.com> wrote:
> > > - I would place .net4 at the bottom of the list.  The value-add seems

Mathias Brandewinder

unread,
Jun 11, 2010, 3:14:14 PM6/11/10
to Excel-Dna
Hello Govert,

Just managed to get it to work, using the Rx version of the TPL -
shaved off a good 40% computation time, with minimal effort - Most of
the work was actually figuring out where the dll was hidden :)

The test case I am working on is inspired by a post on John
Walkenbach's blog where he uses a random walk written in VBA to
benchmark the performance of various systems. As a first step, I just
replaced VBA by a call to a C# dll through ExcelDNA, without any
parallelism, which was already a big improvement:

http://www.clear-lines.com/blog/post/Mutant-Excel-and-Net-with-ExcelDNA.aspx

I'll post what I did with the parallel task library shortly. I don't
think I will be able to bring the time under 1 second, even on my Quad
core, but I have to try!

Mathias

On Jun 3, 12:57 am, Govert van Drimmelen <gov...@icon.co.za> wrote:
> Hi Mathias,
>
> With the Ribbon and RTD support now released, I'm hoping to get some
> feedback on whether those features works OK, need to test a bit more
> under Excel 2010, and then get some Introduction / Getting Started
> page for the hat together.
> I think .Net4 will be the next priority on my list - hopefully around
> August/September.
>
> Note that the Task Parallel Library is available for .Net3.5 SP1 as
> part of the Reactive Extensions library:http://msdn.microsoft.com/en-us/devlabs/ee794896.aspx. This should
> work fine with Excel-Dna, and even from .dna files using the recent
> CompilerVersion attribute (although I haven't tried it myself).
>
> If that version works for you, we'd love to see some examples posted
> of your using it with Excel !!
>
> Regards,
> Govert
>
> On Jun 3, 1:35 am, Mathias Brandewinder
>
>
>
> <mathias.brandewin...@gmail.com> wrote:
> > > - I would place .net4 at the bottom of the list.  The value-add seems

Mathias Brandewinder

unread,
Jun 14, 2010, 4:07:59 PM6/14/10
to Excel-Dna
Here we go - I confirm that you can use the Task Parallel Library with
ExcelDNA:
http://clear-lines.com/blog/post/Supercharge-Excel-functions-with-ExcelDNA-and-Net-parallelism.aspx
Thanks for the pointer Govert.
Reply all
Reply to author
Forward
0 new messages