1

What I'm trying to do:

  • Connecting HANA db from .Net Core application. (Windows environment)

What I did:

  • Downloaded and installed HANA Client for windows. Installed using "hdbinst.exe" from the folder "hdb_client_windows_x86_64" I got it.
  • Created a NuGet package for the file - "Sap.Data.Hana.Core.v2.1.dll" from the path: C:\Program Files\sap\hdbclient\dotnetcore\v2.1
  • Installed this file in to my sample .Net Core 2.1 project thru NuGet package manager.

What I'm experiencing:

  • Warning 1 --> Warning NU1701. Package 'SAP.HANADBClient.NetCore 2.1.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
  • Warning 2 --> Warning MSB3270. There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Users\XXXXX.nuget\packages\sap.hanadbclient.netcore\2.1.0\lib\Sap.Data.Hana.Core.v2.1.dll", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
  • Similar case for .Net Core 2.2 project

What I looked around:

  • I did a search in the web and saw few members had already shared this kind of issue (.Net core with HANA integration). But saw this post saying that the issue got resolved. But was it good? not sure.
  • Even this post says HANA supports .Net Core.
  • Did search in the web, but could not find the solution.

What I'm looking for:

  • Why am I getting these two warnings?
  • Will it give any issues later on - (prod runtime..)
  • Particularly - 2nd warning - why it's looking for "Processor architecture", and how to resolve this.

Can I request any one of you to help me out on this effort. Please let me know still additional details are needed.

Thanks in advance.

Shan
  • 23
  • 1
  • 5
  • Have you recently upgraded your project from .NET 4.6.1 to .NET Core 2.1 or 2.2? If so, you may just need to reinstall your NuGet packages now that your project runtime has changed. – user1477388 Oct 28 '19 at 19:53
  • Thanks for your response!. No, I did not. Created the project with .Net Core. – Shan Oct 29 '19 at 17:06
  • Shan, have you tried re-installing all your packages with a command like `update-package -reinstall`? Ref. https://learn.microsoft.com/en-us/nuget/consume-packages/reinstalling-and-updating-packages – user1477388 Oct 29 '19 at 18:18
  • I just tried this command (along with -source param, as I created my local package repo). Update-Package -Reinstall -Source Did not help.Got this response: The 'Source' parameter is not respected for the transitive package management based project(s) . The enabled sources in your NuGet configuration will be used. No package updates are available from the current package source for project ''. Note: I don't have any update in the pckg file. – Shan Oct 30 '19 at 14:52
  • Have you tried uninstalling and then re-installing the package? – user1477388 Oct 30 '19 at 18:29
  • Yes, that also did not help. Still could see those two warnings !! – Shan Oct 31 '19 at 15:23

1 Answers1

1

To narrow down the issue, try adding the Sap.Data.Hana.Core.v2.1.dll library to your .NET Core 2.1 project directly (not through NuGet) and see if you get the compilation warnings.

If you don't get the warnings, then it's likely your NuGet package that's causing the issue.

If so, how did you create your package? If you created it using the SDK-style, check the TargetFramework to make sure it's set to the correct TFM or TxM as described here.

Also, according to this answer make sure you are using the correct version of the DLL, either x86 or x64.

user1477388
  • 20,790
  • 32
  • 144
  • 264
  • Yeah ! I'm able to clear both warnings. Thank you for continuous assistance. Warning #1: Both ways it's cleared. - If I add reference directly by browsing the dll, it resolved (Not using NuGet). - And also If I followed the folder hierarchy when I create the package (using NuGet Explorer), it resolved. – Shan Nov 04 '19 at 16:45
  • You're welcome! So, that's good news! What about the second warning regarding the processor architecture? Did you ensure you've downloaded the correct DLL, either x86 or x64? Lastly, have you tried recreating your NuGet package using the SDK-style and checking the `TargetFramework` of your projecct settings to ensure it's using the correct TFM or TxM? – user1477388 Nov 04 '19 at 18:01
  • 1
    Second one was also cleared. (I was about to add that in my prev comment, but left half way entering my comments. It was posted !!) In the past I tried to change the project platform to x64 thru Build\Configuration Manager, some how did not help much. I retried again and it works. So, now both warnings are gone. Thanks again. Take care. – Shan Nov 04 '19 at 18:16
  • Shan, you're welcome, buddy! Please feel free to accept my answer or post your own. – user1477388 Nov 05 '19 at 14:56