fsprojects/ExcelFinancialFunctions

Error calculating rate

Closed this issue · 7 comments

Description

All functions work fine when used with C#, however, if I try to come with rate I get the error:

System.IO.FileLoadException occurred
HResult=0x80131040
Message=Could not load file or assembly 'FSharp.Core, Version=3.78.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source=
StackTrace:
at Excel.FinancialFunctions.Tvm.calcRate(Double nper, Double pmt, Double pv, Double fv, PaymentDue pd, Double guess)
at dFin0._002.TVM.JurosButton_Click(Object sender, RoutedEventArgs e) in C:\Users\difio\Documents\Visual Studio 2017\Projects\dFin0.002\dFin0.002\TVM.xaml.cs:line 79

Repro steps

Just running with hardcoded values is well enought:

i = Financial.Rate(12, 0, -100, 313.84, PaymentDue.BeginningOfPeriod);

Expected behavior

Should return a value to "i" variable

Actual behavior

Error message above

Known workarounds

Not known

Related information

  • Windows 10 Pro* Branch
  • .NET 4.6.2

Hi @sdifiore, could you please try to add binding redirects for FSharp.Core (in the config file) depending on what version you have installed on the machine. Here's an example of how it would look for v4.3.1.0:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        ...
        <runtime>
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
              <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
              <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.1.0" />
            </dependentAssembly>
          </assemblyBinding>
        </runtime>
    </configuration>

Cheers,
Natallie

That would be App.config file in your project (the one that calls Excel funcs, more info here). I don't have Windows machine, but guess that in your case it should be oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0".

I am getting the same issue - I see the references are correct and the same line is present in my app.config

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0" /> </dependentAssembly> </assemblyBinding>
Please let me know what I am doing wrong?

Hi, I am cleaning up old issues. I just tested this using net462 and the 2.4.1 release of the library from NuGet. This worked fine. If this is still an issue, perhaps try again?

Project files used to test: issue-14.zip

Just got your messages.
I'll do it and migrate do .Net Core!!!

Great, we'll look forward to hearing how it goes.