Hi Bart,
I get this error when rebuilding:
1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "SharpProj, Version=8.2001.106.0, Culture=neutral, PublicKeyToken=3a930e679d9a0873, processorArchitecture=x86", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
I’m guessing the SharpProj.dll that ends up in the output directory is a 32-bit library.
It might be that on your new machine (or in the new version of ExcelDnaDoc), ExcelDnaDoc is running as a 64-bit process, then can’t load the 32-bit SharpProj.dll.
Then your add-in also won’t work on 64-bit Excel with this SharpProj.dll.
I see that the SharpProj.Core package has both 32-bit and 64-bit files.
One would have to dig a bit to understand how the build decides which one to use, and whether the project file has to change.
Maybe because you are using a packages.config or something with the project file.
I hope that give you some clue.
I’ll try to poke some more if I get a chance.
-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/b3129f3b-2af0-4a8b-ac75-c51682b93601n%40googlegroups.com.
Hi Bart,
The mechanism SharpProj uses to copy the right bitness version of SharpProj.dll to the output (using a runtimes directory in the NuGet package) only works under .NET Core.
See more here NuGet: references to assemblies in runtimes folder not added - Stack Overflow
So for .NET Framework you need something more explicit.
My Excel is 64-bit, so that’s the version I want to build and run.
So I’ve fixed up the post-build step like this, to copy the 64-bit version and then run ExcelDnaDoc.
REM if $(ConfigurationName)==Release "$(SolutionDir)batch\publish.bat" $(SolutionDir) $(ConfigurationName)
copy "C:\Work\Github\Duijndam-Dev\TopoLib\packages\SharpProj.Core.8.2001.106\runtimes\win-x64\lib\net45\SharpProj.dll" "$(TargetDir)"
"C:\Work\Github\Duijndam-Dev\TopoLib\packages\ExcelDnaDoc.1.5.1\tools\ExcelDnaDoc.exe" "$(TargetDir)TopoLib-AddIn.dna" /X
After doing this, the ExcelDnaDoc runs fine, and the add-in works beautifully, including the help file.
I’m not sure what the most elegant way is to make the two add-ins (32/64) with the respective SharpProj.dll versions.
But at least it makes sense what you’re seeing.
-Govert
Hi Bart,
If you copy the 64-bit version of SharpProj.dll to the output directory before ExcelDnaDoc is called, does it run successfully for you?
That seemed to work for me.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/ba4d5e2b-30e9-470c-95d4-65ab9a501a83n%40googlegroups.com.
Hi Bart,
I’m copying the 64-bit version of SharpProj.dll to the output directory for two reasons:
While you are right that you need the 32-bit version there for running the add-in, I think you will anyway need the 64-bit version there when ExcelDnaDoc runs. Afterwards you can put back the 32-bit version to run the add-in.
On a 32-bit installation of _Windows_, ExcelDnaDoc would run as a 32-bit process.
-Govert
From: exce...@googlegroups.com <exce...@googlegroups.com> On Behalf Of Bart Duijndam
Sent: 17 January 2022 10:43
To: Excel-DNA <exce...@googlegroups.com>
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/25e367b3-279c-43e0-aca9-1bbdcc835a0an%40googlegroups.com.
So I guess for your post-build step you would then have something like this (adjusting the paths as needed)
REM if $(ConfigurationName)==Release "$(SolutionDir)batch\publish.bat" $(SolutionDir) $(ConfigurationName)
copy "C:\Work\Github\Duijndam-Dev\TopoLib\packages\SharpProj.Core.8.2001.106\runtimes\win-x64\lib\net45\SharpProj.dll" "$(TargetDir)"
"C:\Work\Github\Duijndam-Dev\TopoLib\packages\ExcelDnaDoc.1.5.1\tools\ExcelDnaDoc.exe" "$(TargetDir)TopoLib-AddIn.dna" /X
copy "C:\Work\Github\Duijndam-Dev\TopoLib\packages\SharpProj.Core.8.2001.106\runtimes\win-x86\lib\net45\SharpProj.dll" "$(TargetDir)"
-Govert
From: exce...@googlegroups.com <exce...@googlegroups.com> On Behalf Of Bart Duijndam
Sent: 17 January 2022 10:43
To: Excel-DNA <exce...@googlegroups.com>
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/25e367b3-279c-43e0-aca9-1bbdcc835a0an%40googlegroups.com.
Hi Bart,
Thank you very much for signing up as a Sponsor @Excel-DNA on GitHub Sponsors!
I’m glad you’ve got your project working now - the TopoLib add-in looks very nice.
-Govert
From: exce...@googlegroups.com <exce...@googlegroups.com> On Behalf Of Bart Duijndam
Sent: 17 January 2022 11:55
To: Excel-DNA <exce...@googlegroups.com>
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/c38f8fd1-3998-433b-9397-341636ac9e1an%40googlegroups.com.