Some questions about the upgraded version

114 views
Skip to first unread message

Ash Hui

unread,
Jul 8, 2024, 11:50:59 PM (13 days ago) Jul 8
to Excel-DNA
I haven't upgraded exceldna's library version for a long time, and then recently I saw from nuget that the version has changed a lot, and the version I am currently using is very old. I would like to ask, which version should I upgrade to currently? Are there any precautions after upgrading? (Because I seemed to have simply tried to upgrade all libraries to the highest version before, but the project could not run normally after the upgrade, so I stopped trying) The programming language I use is vb.net The version I'm currently using:
ExcelDna.AddIn  1.1.1
ExcelDna.Integration  1.1.0
ExcelDna.Interop  15.0.1 (之前只升这个不会异常)
ExcelDna.Registration  0.34.7
ExcelDna.Registration.VisualBasic   0.34.7

Govert van Drimmelen

unread,
Jul 9, 2024, 2:57:33 PM (13 days ago) Jul 9
to Excel-DNA
When upgrading an old project to the current v1.8.0 packages, you might keep the following in mind.

Your project is probably an old-style .vbproj file, and not yet the new 'SDK-style' project file.
That's a big topic, but you need to be aware of the differences.
Old-style project files typically use a separate .packages.config file to specify the NuGet packages.

If you upgrade your packages while staying with the old-style project file and packages.config file, I think the only issue you need to be aware of is the post-build steps that the Excel-DNA package might have added to your project. When building after the upgrade, you might get an error because of this. If you look at the post-build steps, you can delete any that look like they come from Excel-DNA. Sometimes the .vbproj project file itself has some other entries at the bottom with version checks relating to the Excel-DNA packages. You might need to remove these too, if you have problems building after the update.

I would, however, suggest that you upgrade to an SDK-style project file. This is not a requirement for using the current Excel-DNA packages, but seems to be the recommended direction going forward, and has advantages like easier build customization, and easy editing of the project file in Visual Studio. This can be as easy as making a new project in Visual Studio (selecting the "Class Library" template and not "Class Library (.NET Framework)", setting the target runtime back to "net472" or similar to target .NET Framework, then adding the <PackageReference> entries you require. Finally, you can replace your old project file with this new one, and proceed to fix as necessary. One gotcha is that the output directory will change to now include the target framework name. For Excel-DNA, when you move to an SDK-style project file, you can also remove the .dna files that were part of your project and add the customization you had in the .dna files into your project file directly. Regarding your question from another discussion thread, if you move to an SDK-style project file, then dependencies of your packages are automatically references, so you won't need the ExcelDna.Integration package (ExcelDna.Addin brings it in) nor ExcelDna.Registration (ExcelDna.Registration.VisualBasic brings it in).

So overall, I suggest first upgrading using the existing project file, and fixing anything you run into. Then plan to do the more tricky job of updating the project file to prepare for the longer term maintenance of the project.

You're very welcome to ask here if you run into any unexpected problecmt with the update.

-Govert

Ash Hui

unread,
Jul 17, 2024, 6:06:42 AM (5 days ago) Jul 17
to Excel-DNA


I upgraded all plug-ins to version 1.8. After the upgrade, an error will be reported when compiling:
BC30420: 'Sub Main' was not found in 'ADL-AddIn'
How to solve this error?

current  packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Csv" version="2.0.93" targetFramework="net48" />
  <package id="ExcelDna.AddIn" version="1.8.0" targetFramework="net48" developmentDependency="true" />
  <package id="ExcelDna.Integration" version="1.8.0" targetFramework="net48" />
  <package id="ExcelDna.Interop" version="15.0.1" targetFramework="net48" />
  <package id="ExcelDna.Registration" version="1.8.0" targetFramework="net48" />
  <package id="ExcelDna.Registration.VisualBasic" version="1.8.0" targetFramework="net48" />
  <package id="Microsoft.CSharp" version="4.7.0" targetFramework="net48" />
  <package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1001" targetFramework="net48" />
</packages>

Ash Hui

unread,
Jul 17, 2024, 6:15:42 AM (5 days ago) Jul 17
to Excel-DNA
ADL-AddIn.dna:
<?xml version="1.0" encoding="utf-8"?>
<DnaLibrary Name="ADL-AddIn" RuntimeVersion="v4.0" xmlns="http://schemas.excel-dna.net/addin/2018/05/dnalibrary">
  <ExternalLibrary Path="ADL-AddIn.dll" ExplicitExports="false" LoadFromBytes="true" Pack="true" ExplicitRegistration="true" IncludePdb="false" />
  <Reference Path="ExcelDna.Registration.dll" Pack="true" />
  <Reference Path="ExcelDna.Registration.VisualBasic.dll" Pack="true" />
  <Reference Path="Csv.dll" Pack="true" />
</DnaLibrary>

Govert van Drimmelen

unread,
Jul 17, 2024, 6:46:58 AM (5 days ago) Jul 17
to exce...@googlegroups.com

Check that your project file does not have

    <OutputType>Exe</OutputType>

 

You might need

    <OutputType>Library</OutputType>

Though that should be the implied default if you don’t set this property.

 

Also, check that you don’t have a StartupObject set.

 

-Govert

--
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/053da0e7-6c88-4464-9d88-11368d4f906cn%40googlegroups.com.

Govert van Drimmelen

unread,
Jul 17, 2024, 6:49:04 AM (5 days ago) Jul 17
to Excel-DNA
You also don't need the 'Microsoft.Office.Interop.Excel' package if you have 'ExcelDna.Interop' (which is better).

-Govert

Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Ash Hui

unread,
Jul 20, 2024, 2:07:59 AM (2 days ago) Jul 20
to Excel-DNA
 How to set these two items?
  <OutputType>Library</OutputType>
StartupObject 

Ash Hui

unread,
Jul 20, 2024, 2:07:59 AM (2 days ago) Jul 20
to Excel-DNA
if i use  SDK-style project,
Is it still necessary to use:Exceldna.Intellisense64 ?
在2024年7月17日星期三 UTC+8 18:49:04<Govert van Drimmelen> 写道:

Ash Hui

unread,
Jul 20, 2024, 2:07:59 AM (2 days ago) Jul 20
to Excel-DNA

I did not configure these two items:

   <OutputType>Library</OutputType>
 StartupObject

Because the version I used before did not have these configurations and it could run normally, these two items should be added in the new version.
How to configure it?





Also, I have  'ExcelDna.Interop' ,I have now annotated: 'Microsoft.Office.Interop.Excel' 
在2024年7月17日星期三 UTC+8 18:49:04<Govert van Drimmelen> 写道:

Ash Hui

unread,
Jul 20, 2024, 2:07:59 AM (2 days ago) Jul 20
to Excel-DNA

None of the following are available:
<OutputType>Exe</OutputType>
StartupObject
may I ask about the settings?


Because the version I used before did not require these settings to run normally, are these two settings new content that needs to be set in the new version?

 

Also, I  have 'ExcelDna.Interop',I just commented 'Microsoft.Office.Interop.Excel' in packages.config。

在2024年7月17日星期三 UTC+8 18:49:04<Govert van Drimmelen> 写道:

Ash Hui

unread,
Jul 20, 2024, 3:19:32 AM (2 days ago) Jul 20
to Excel-DNA

There is no problem now. I didn’t know why the above four questions were deleted after I posted them, but then they suddenly appeared again. It felt very strange.
Reply all
Reply to author
Forward
0 new messages