And here's a cut from the brodge PRG code
Code:
FUNCTION Init(lcVersion, llUseCom)
IF !EMPTY(lcVersion)
LOCAL lcShortVer
lcShortVer = UPPER(lcVersion)
DO CASE
CASE lcShortVer == "V4"
lcVersion = "v4.0.30319"
CASE lcShortVer == "V2"
lcVersion = "v2.0.50727"
ENDCASE
this.cClrVersion = lcVersion
ENDIF
It shows that
1. Rick strahl has forseen specifying V2 or V4 in these shortcut versions.
2. You can specify other specific versions.
3. The bridge can also use COM, yes, specified in the second llUseCOM parameter
But what does that mean? You then leave it to the OS COM mechanism, which generally instance OLE classes to also invoke the corresponding runtime. It's still only there when it's there, it's still needing a runtime, nothing runs without a runtime.
Since you target your VFPQRCOder DLL to one or some .NET versions you know what you want. It might be possible to provide several DLLs, as they also come from the QRCoder solution in
...\QRCoder\bin\Release\netstandard2.0
...\QRCoder\bin\Release\net35
...\QRCoder\bin\Release\net40
...\QRCoder\bin\Release\netstandard1.1
When you pick your .NET target version you also pick what QRCoder.dll you'll reference.
Now I think it would get complicated to need to provide a bunch of DLLs to be able to use one of them. Even if COM instancing instead of the bridge loading a .NET version, you'll need to provide versions for the different versions and register them all with regasm. That doesn't make it really simpler. It may then support more customers with what they already have.
But when you reference QRCoder you pick a version already anyway. I picked .NET 4 for my project first and the reference to QRCoder.dll then is its packages\QRCoder.1.4.0\lib\net40\QRCoder.dll, so I am locked in one version the way I configured my project anyway. I could imagine you can also target more versions and have a bunch of outputs like the QRCoder solution. But I don't think that's necessary for the range of OSes supporting 4.0 assemblies is still current Windows and also reaches back to XP. And it contradicts the reason to use the bridge. That use com parameter is okay for system assemblies or the like, available in different versions on different target machines. But if you bring in a software, and then need to bring in several versions and register them with regasm, then you can use it via COM even without the bridge. That doesn't remove complexity.
All that said, I would double-check if the problem you have using the bridge is really your OS or a missing .NET 4.0 version and not just wrong path, missing files from the bridge zip, etc. "V4" is translated to "v4.0.30319" and also is the class definition line cClrVersion = "v4.0.30319". And that was also a reason I targeted .NET 4.0 too. But you are not limited to V2 and V4 parameters and "v4.0.30319" default, you can pass in any concrete version number, too, like a 4.5 version. It's just not a version QRCoder has in its outputs, so you'd have to add it there. Totally possible, I don't think 4.5 deprecates anything that needs special different handling. But I also opted for just using the given binaries from the Nuget source, as I struggled to get the QRCoder solution to compile in the first place, in VS 2017.
Bye, Olaf.
Olaf Doschke Software Engineering