question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

F# complie xll failed.

See original GitHub issue

I used Rider to create a .Net Framework Class Library, and tried to compile the xll file but failed. Here is the log file: ` 生成启动时间为 2020/11/15 12:32:33。 日志记录详细程度设置为: Normal。 1>项目“C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\UDFs.fsproj”在节点 1 上(build 个目标)。 1>GenerateTargetFrameworkMonikerAttribute: 正在跳过目标“GenerateTargetFrameworkMonikerAttribute”,因为所有输出文件相对于输入文件而言都是最新的。 CoreCompile: C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\packages\FSharp.Compiler.Tools.10.0.2\build..\tools\fsc.exe -o:obj\Debug\UDFs.dll -g –debug:portable –noframework –define:DEBUG –define:TRACE –optimize- –tailcalls- -r:C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\packages\ExcelDna.Integration.1.1.0\lib\ExcelDna.Integration.dll -r:C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\packages\FSharp.Core.4.5.2\lib\net45\FSharp.Core.dll -r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\mscorlib.dll -r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Core.dll -r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.dll -r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Numerics.dll –target:library –warn:3 –warnaserror:76 –fullpaths –flaterrors –subsystemversion:6.00 –highentropyva+ –warnon:1182 AssemblyInfo.fs Library.fs obj\Debug.NETFramework,Version=v4.5.AssemblyAttributes.fs

 1>C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\Library.fs(7,9): warning FS1182: The value 'add' is unused
   _CopyFilesMarkedCopyLocal:
     正在对“C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\obj\Debug\UDFs.fsproj.CopyComplete”执行 Touch 任务。
   CopyFilesToOutputDirectory:
     正在将文件从“C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\obj\Debug\UDFs.dll”复制到“C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\bin\Debug\UDFs.dll”。
     UDFs -> C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\bin\Debug\UDFs.dll
     正在将文件从“C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\obj\Debug\UDFs.pdb”复制到“C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\bin\Debug\UDFs.pdb”。
   ExcelDnaBuild:
     ---
     ExcelDnaBuild: Running CreateExcelAddIn MSBuild Task
     ExcelDnaBuild: ----Arguments----
     ExcelDnaBuild: FilesInProject: 3
     ExcelDnaBuild:   ExcelDna-Template.dna
     ExcelDnaBuild:   packages.config
     ExcelDnaBuild:   Properties\ExcelDna.Build.props
     ExcelDnaBuild: OutDirectory: bin\Debug\
     ExcelDnaBuild: Xll32FilePath: C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\packages\ExcelDna.AddIn.1.1.1\build\..\tools\ExcelDna.xll
     ExcelDnaBuild: Xll64FilePath: C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\packages\ExcelDna.AddIn.1.1.1\build\..\tools\ExcelDna64.xll
     ExcelDnaBuild: Create32BitAddIn: True
     ExcelDnaBuild: Create64BitAddIn: True
     ExcelDnaBuild: FileSuffix32Bit: 
     ExcelDnaBuild: FileSuffix64Bit: 64
     ExcelDnaBuild: -----------------
     ExcelDnaBuild: Number of files in project: 3
     ExcelDnaBuild: ExcelDna-Template.dna -> bin\Debug\ExcelDna-Template.dna
     ExcelDnaBuild: packages\ExcelDna.AddIn.1.1.1\build\..\tools\ExcelDna.xll -> bin\Debug\ExcelDna-Template.xll
     ExcelDnaBuild: ---
     ExcelDnaBuild: ExcelDna-Template.dna -> bin\Debug\ExcelDna-Template64.dna
     ExcelDnaBuild: packages\ExcelDna.AddIn.1.1.1\build\..\tools\ExcelDna64.xll -> bin\Debug\ExcelDna-Template64.xll
     ---
   ExcelDnaPack:
     ExcelDnaPack: bin\Debug\ExcelDna-Template.dna -> bin\Debug\ExcelDna-Template-packed.xll
     "C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\packages\ExcelDna.AddIn.1.1.1\build\..\tools\ExcelDnaPack.exe" "bin\Debug\ExcelDna-Template.dna" /Y  /O "bin\Debug\ExcelDna-Template-packed.xll"
     Using base add-in bin\Debug\ExcelDna-Template.xll
     !!! ExternalLibrary `%OutputFileName%` not found. Aborting.
 1>C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\packages\ExcelDna.AddIn.1.1.1\build\ExcelDna.AddIn.targets(196,5): error MSB3073: 命令“"C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\packages\ExcelDna.AddIn.1.1.1\build\..\tools\ExcelDnaPack.exe" "bin\Debug\ExcelDna-Template.dna" /Y  /O "bin\Debug\ExcelDna-Template-packed.xll"”已退出,代码为 1。
 1>已完成生成项目“C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\UDFs.fsproj”(build 个目标)的操作 - 失败。

生成失败。

   “C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\UDFs.fsproj”(build 目标) (1) ->
   (CoreCompile 目标) -> 
     C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\Library.fs(7,9): warning FS1182: The value 'add' is unused


   “C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\UDFs.fsproj”(build 目标) (1) ->
   (ExcelDnaPack 目标) -> 
     C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\packages\ExcelDna.AddIn.1.1.1\build\ExcelDna.AddIn.targets(196,5): error MSB3073: 命令“"C:\Users\Victor\Documents\scripts\fsharp\ExcelAddIn\UDFs\packages\ExcelDna.AddIn.1.1.1\build\..\tools\ExcelDnaPack.exe" "bin\Debug\ExcelDna-Template.dna" /Y  /O "bin\Debug\ExcelDna-Template-packed.xll"”已退出,代码为 1。

1 个警告
1 个错误

已用时间 00:00:04.10

`

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
govertcommented, Nov 16, 2020

It looks like the <DnaLibrary Name="%...." /> should also be fixed.

Then the function must be static for it to be recognized by Excel-DNA. Top-level code in a module would also work.

Try this as your F# source file:

module MyFunctions

open ExcelDna.Integration

[<ExcelFunction(Description="My first .NET function")>]
let HelloDna name =
    "Hello " + name
1reaction
govertcommented, Nov 15, 2020

I don’t know Rider or Chinese, so it’s really hard for me to support. One problem is that Rider does not install the NuGet package correctly. You can try to fix this by:

  • Renaming the “ExcelDna-Template.dna” file to “UDFs-AddIn.dna”.
  • Then edit the “UDFs-AddIn.dna” file and change the “%OutputFileName%” to “Udfs.dll”. Maybe it will work then.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to use .dll library because of outdated F# compiler in ...
Unfortunately, there is no way to use such a .dll from an older compiler that doesn't understand Anonymous Records.
Read more >
Error compiling multiple .F files into single DLL
Hi there, I am trying to compile multiple Fortran files into a single DLL and am getting the following message when creating the...
Read more >
How to use the Regsvr32 tool and troubleshoot ...
Describes how to use the Regsvr32 tool to register and unregister OLE controls. Also describes the error messages that may occur and what...
Read more >
Create and use your own Dynamic Link Library (C++)
This step-by-step walkthrough shows how to use the Visual Studio IDE to create your own dynamic link library (DLL) written in Microsoft C++...
Read more >
[RESOLVED] Dev-C++ linker error when compiling DLL
Hi folks! I'm trying to develop an electronic device that is supposed to use the FT232 chip from FTDI to communicate with my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found