Use Rider instead of VisualStudio?

481 views
Skip to first unread message

O.F.K.

unread,
Feb 12, 2020, 4:19:54 AM2/12/20
to Excel-DNA
Hello to all.

As the title of my question asks, I have searched the group's content using the search bar, scrolled a few pages' worth of content, but didn't find any mention.
So I'm asking, can Excel-DNA be used with JetBrains Rider? If so, what needs to be configured (I'm guessing the build configs, but what and how, I can't figure out on my own using available VS documents)?

Thanks in advance.

O.F.K.

unread,
Feb 12, 2020, 5:41:51 AM2/12/20
to Excel-DNA
After some trial and error, I found out that what crashes my build is that the ExternalLibrary is not found.

I don't really know what this ExternalLibrary is, although it seems to have a lot of attributes, but, no matter what value I provided for the %OutputPath% (or a similar sounding attribute, I don't have the project in front of me right now), it says it can't find it.
Obviously, I'm doing something wrong, like I said, I don't know what it means, nor any of its attributes.

By the way, if I comment out the entire tag (i.e. <!-- <ExternalLibrary........ /> -->), the code does compile... only I get a .xll file that does nothing!
I upload it into Excel and... nothing.
The HelloDna function that should be available, is not.

I hope this information can give you a clue at what I need to change to get the project to compile and produce a meaningful .xll file.

Thanks in advance again.

Caio Proiete

unread,
Feb 13, 2020, 9:10:21 AM2/13/20
to exce...@googlegroups.com
Hi,

We don't actively use/test Excel-DNA with Rider, so feel free to use it at your own risk.

The main reason you get the errors you mention is because Excel-DNA currently relies on a Powershell script that runs when the NuGet package is installed, and it performs some changes to your project, including setting properties in your .dna template file that is added to the project, and unfortunately Rider doesn't execute the Powershell script which causes your project settings to be incomplete, so in order to use Rider you'll have to manually execute the steps in the install.ps1 script yourself, as well as turn off the debugging integration with Visual Studio by setting $(RunExcelDnaSetDebuggerOptions) to false.

Attached is an example of a solution I created with Visual Studio + Excel-DNA of how your Rider solution should look like if you created a new project called "ExampleExcelDnaWithRider". You can use that as a starting point if you want.

NB: We are working to remove the need for the Powershell as we update ExcelDna.AddIn to support the new PackageReference format, which should make the experience with Rider better, by consequence. You might want to subscribe to this issue #193 and #297.

Cheers,
Caio Proiete


--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/a57856c4-0632-4270-ade0-b4f49b058ad1%40googlegroups.com.
ExampleExcelDnaWithRider.zip

O.F.K.

unread,
Feb 14, 2020, 4:52:58 PM2/14/20
to Excel-DNA
Thanks for answering.

Actually, when using Rider's built-in Nuget manager, it does load the install.ps1 script, so changes to the project file did happen. At least partially, which was the reason for my question.
Also, after reviewing the examples on the GitHub page I was able to deduce the ExternalLibrary is actually the .dll which is compiled when building the project... but I failed to notice you also need to set the ProjectName...

So, to help any future users that may wonder, here's a play-by-play of how I got the HelloDna example project/function to compile and run inside Excel, using Rider for the development (of course, as is par for the course in these situations, your mileage may vary):

  • Start a Class Library project in Rider.
  • Use Rider's built-in Nuget manager to install the plugin, ExcelDna-AddIn.
  • Check the .*proj (either cs or fs)... it should be altered by the plugin's installation script. If it wasn't, run the script manually (it's in the tools folder somewhere, name's "install.ps1").
  • If everything worked correctly, view, inside tools folder, the build settings and setting the VS debugging setting to false (as indicated in the answer by Caio Proiete).
  • Use whichever way is easier for you to build the project (the hammer icon in Rider, running MSBuild for command-line, etc.)
  • Check the folder <build_config>/bin for the .xll files, 4 of them. They should be auto-created by the build script. Take the one with the -packed suffix and bit-ness according to your Excel/machine.
  • If the files were not created for some reason, run the creator app (TODO: Placeholder, fill in correct path and usage here).

If the build script/you created the .xll files, you loaded the correct one to Excel and no HelloDna function is available, most likely the .dll file, the result of the build, didn't work correctly (I had this problem, and it took me two days figuring out the issue was the .dll and not the resulting .xll!)

The best course of action I can advise on in this case is to delete the .dll and .pdb files that are currently available and re-build the solution, creating new .dll files (and, in most cases, new .xll files as well).
Reply all
Reply to author
Forward
0 new messages