简体   繁体   中英

Fsharp.Core dependency from nuget package doesn't get copied to bin directory

I'm using ExcelFinancialFunctions nuget package in a C# library (DLL) project (let's call it A ), that project A is referenced by project B , And I have a unit tests project C that references project B

So the dependency path is C > B > A

ExcelFinancialFunctions depends on Fsharp.Core.

Now when I build project C , Fsharp.Core.dll gets copied to bin directory of project A with ExcelFinancialFunctions.dll, but it's not the case for projects B and C ; their bin directory has ExcelFinancialFunctions.dll only and that causes a runtime error whenever any function in ExcelFinancialFunctions.dll is called.

I followed the steps in this answer and found there's a problem in binding the version of FSharp.Core, so I added the piece below to the unit test project app.config

  <dependentAssembly>
    <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="4.4.0.0" />
  </dependentAssembly>

so 4.4.0.0 is the version downloaded with the the Nuget package, and I'm doing range (0-5) redirect, because in the output window of the build, I saw a step trying to load a version higher than 4.4.0.0, probably trying to load it from the installed .NET SDK (I have .NET Framework 4.7.2, didn't investigate the reason it tries to load a higher version though)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM