We have a .NET 6 UDF project that has a Pre-Build event script (written in PowerShell) specified in the project's build properties. The script generates a .dna file whose content varies based on arguments passed to the PowerShell script. The name of the generated .dna file depends on the arguments passed to the PowerShell script. (There's also a Post-Build clean-up script but that's irrelevant for this discussion.)
The name of the Project is, RiskTools.
The pre-Build script should, to my understanding, run before the project begins building. But take a look at these two lines of output from the Build Log:
2>ExcelDnaSetLaunchSettings: Add-In for debugging: bin\Debug\net6.0-windows\RiskTools-AddIn-64.xll
2>***** PRE BUILD STEP STARTING
The second line represents the start of execution of the Pre-Build script. Notice the first line though. The ExcelDna (is it the build task?) has already determined the name of the generated .XLL file. It has made this determination before the Pre-Build script even started execution and before the .dna file could be generated!
The problem is that we do not want the name of the XLL file to be determined until after the Pre-Build step completes and the .dna file has been generated. Is there anything we can do to adjust this? The default XLL file name, RiskTools-Addin-64.xll is wrong, as are its contents.
Our Pre-Build script works correctly and generates a valid .dna file which is promptly ignored by the Exce-DNA Build task.