fsprojects / ExcelFinancialFunctions

.NET Standard library providing the full set of financial functions from Excel.
https://fsprojects.github.io/ExcelFinancialFunctions
Other
196 stars 66 forks source link

Error calculating rate #14

Closed sdifiore closed 3 years ago

sdifiore commented 7 years ago

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

luajalla commented 7 years ago

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

sdifiore commented 7 years ago

As a newbie I’m cant’ really say I know where is this config file...

From: Natallie Baikevich [mailto:notifications@github.com] Sent: segunda-feira, 27 de março de 2017 05:30 To: fsprojects/ExcelFinancialFunctions ExcelFinancialFunctions@noreply.github.com Cc: Sergio difiores@outlook.com; Mention mention@noreply.github.com Subject: Re: [fsprojects/ExcelFinancialFunctions] Error calculating rate (#14)

Hi @sdifiorehttps://github.com/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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/fsprojects/ExcelFinancialFunctions/issues/14#issuecomment-289387313, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADdV1cSLy0UALnT16wztNLij9f0bTYiiks5rp3N5gaJpZM4MpnKC.

luajalla commented 7 years ago

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".

ghost commented 7 years ago

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

`

` Please let me know what I am doing wrong?

jcoliz commented 3 years ago

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

sdifiore commented 3 years ago

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

jcoliz commented 3 years ago

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