5

I am trying to integrate CcAvenue Payment Gateway in an application that we are currently developing in Asp.Net Core MVC 2.0. Now the trouble is to load an dll assembly provided by them.

This is build in .Net 3.5 and the application displays this exception

FileNotFoundException: Could not load file or assembly 'MCPG.CCA.Util, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3d7072b2634875da'. The system cannot find the file specified.

johnnyRose
  • 7,310
  • 17
  • 40
  • 61
vivek
  • 1,595
  • 2
  • 18
  • 35
  • 1
    I'd say no : https://learn.microsoft.com/en-us/dotnet/standard/choosing-core-framework-server – Atlasmaybe Jan 24 '18 at 09:45
  • Definitely not. 3.5 is actually .NET 2.0 with WPF, WCF, WF. It's not even supported anymore. The earliest supported .NET version is 4.5.2. .NET Core can load assemblies that follow one of the [.NET Standard specifications[(https://learn.microsoft.com/en-us/dotnet/standard/net-standard). The lowest one 1.0, is covered by .NET 4.5 – Panagiotis Kanavos Jan 24 '18 at 13:12
  • There should be no reason why you have to use your payment gateway's library. They have an [integration document](http://www.bookhungama.com/pdfs/1442054378_CCAvenueIntegration-Ver2.4.pdf) that you should be able to follow to submit your own request to them using classes from the .NET System.Net namespace. – NightOwl888 Jan 27 '18 at 16:37

1 Answers1

2

Sure you can, .net core 2.0 allows you to reference any .net version as long as it is .net standard 2.0 compliant (which it probably is as long as it isn't using Windows specific libraries)

https://blogs.msdn.microsoft.com/dotnet/2017/06/28/announcing-net-core-2-0-preview-2/#user-content-reference-net-framework-libraries-from-net-standard

keep in mind that you will get a warning, (this basically means that in theory there might be something wrong - so you should make sure everything actually works, and it largely depends on the library you are referencing)

As for your error, I am not familiar with the 'MCPG.CCA.Util' Library - but are you referencing it directly? If you are then this specific library is using Windows specific APIs (seems odd to me, you are probably not referencing the library directly) then look at this discusion it might help you

gilmishal
  • 1,884
  • 1
  • 22
  • 37
  • And .NET 3.5 is *not* compliant - it's .NET 2.0 with some extra libraries. It's not even supported any more. It's a different binary than the current generation of .NET Framework, the one that started with .NET 4.0. – Panagiotis Kanavos Jan 24 '18 at 13:08
  • have you seen the link? You can reference any .NET framework version even .NET 1. .NET 3.5 isn't complaint in the sense that it can't reference .net standard - but if it doesn't use windows specific libraries, meaning it doesn't use libraries that are not part of the .NET standard, than it should work. – gilmishal Jan 24 '18 at 13:12
  • I quote "The supported scenario is referencing a .NET Framework library that happens to only use types within the .NET Standard API set. Also, it is only supported for libraries that target .NET Framework 4.6.1 or earlier (****even .NET Framework 1.0 is fine*****). If the .NET Framework library you reference relies on WPF, the library will not work (or at least not in all cases). You can use libraries that depend on additional APIs,but not for the codepaths you use. In that case, you will need to invest singificantly in testing." – gilmishal Jan 24 '18 at 13:13
  • you should probably read it again because it says the exact opposite of what you assume. The article talks about .NET *standard*, not .NET 1.0. The 1.0 series of the framework of 2002, 2003 was a different runtime than the 2.0 series that came out in 2005, you couldn't even load a 1.1 assembly in a .NET 2.0 project. The 4.0 series that started in 2010 was also a different runtime but at least you could load 2.0 assemblies. .NET Core only loads assemblies that cover the .NET **Standard** or Core. The oldest version covered by Standard 1.0 is 4.5 – Panagiotis Kanavos Jan 24 '18 at 13:17
  • Check the [.NET Implementation Support](https://learn.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support) matrix for specifics. As for the paragraph you quoted, check its beginning: `You can now reference .NET Framework libraries from .NET Standard libraries using Visual Studio 2017 15.3. this scenario is more nuanced than is typical.`. This means that *maybe* a Core application can reference a Standard DLL that references an older .NET Framework DLL only if it uses libraries that are covered by .NET Standard – Panagiotis Kanavos Jan 24 '18 at 13:21
  • NO, you are wrong. The link clearly states referencing .NET Framework 4.6.1 or earlier, even .NET Framework 1.0 (yes the same framework from 2002, there is no other .NET Framework 1.0). You are aware .NET is backwards compatible the CLI was enhanced, but it is still backwards compatible. You are talking nonsense. – gilmishal Jan 24 '18 at 13:21
  • read the article section again. It talks about Core > Standard > Framework. Not Core > Framework – Panagiotis Kanavos Jan 24 '18 at 13:21
  • `This means that maybe a Core application can reference a Standard DLL that references an older .NET Framework DLL only if it uses libraries that are covered by .NET Standard` Exactly what I said, except it is more likely that it uses libraries that are covered by .NET standard than it isn't, unless of course they are a UI library such as winforms or WPF. – gilmishal Jan 24 '18 at 13:24
  • maybe this would be settle with some proof-of-concept project ? – Pac0 Jan 27 '18 at 16:35
  • It worked. I just referenced assembly using add reference menu. Then under the bin folder I copied it to all three folders. The folder names were debug, release and Any CPU. Thanks – vivek Jan 30 '18 at 12:16
  • Glad to have helped you – gilmishal Jan 30 '18 at 12:17