Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Newer than currently loaded runtime?

$
0
0
Re: Newer than currently loaded runtime?
VFP and .NET Interop
Re: Newer than currently loaded runtime?
10/14/2012
02:31:05 PM
3MC0V4BS5 Show this entire thread in new window
Gratar Image based on email address
From:
Rick Strahl
To:
Attachments:
None
Stein,

This works for me with the code you sent:

do wwDotNetBridge LOCAL loBridge as wwDotNetBridge loBridge = CreateObject("wwDotNetBridge") ? loBridge.GetDotnetversion() ? loBridge.LoadAssembly("C:\temp\hasher\Hasher\bin\Release\hasher.dll") ? loBridge.cErrorMsg loHasher = lObridge.CreateInstance("Hasher.generateHash") ? loHasher.GetBase64HashString("key","Long String of Data")

The project you sent didn't compile as is, so I think you probably compiled and didn't notice that the compile failed. You had the 4.0 Microsoft.Csharp assembly still in the project which failed. So you likely just continued to run the 4.0 compiled assembly. Once I removed the reference, recompiled under 3.5 the code above works just fine.

+++ Rick ---




Stein,

You can only load one runtime into VFP. So repeated calls to create an instance of wwDotnetBridge will always use the first runtime loaded regardless of what you pass for a version parameter.

That might explain why the behavior seemed inconsistent.

.NET 3.5 is really .NET 2.0 runtime - the runtime version is the same, only new libraries were added in 3.5.

If you start with V4 and you end up with V2 that means that V4 is not installed and the latest available version was loaded (which is 2.0).

Now why you're getting this error I don't know. Are you sure you built this with .NET 3.5 and that it doesn't have dependencies on later assemblies (that shouldn't really be possible). Further are you sure that .NET 3.5 is installed on the target system where you are running this?


I originally built this with the 4.0 framework - then recompiled under 3.5 - so that may also have confused the issue. I verified that I do have 3.5 on this system.


I think if you install .NET 4.0 and run under V4 it'll likely work, but this shouldn't be necessary.

Easy enough to do that on my system, I'd prefer not to have to force it on customers.

Can you send me the assembly and I can take a look at it here...

Will do, thanks.

--stein


+++ Rick ---



I built a small assembly and am trying to load it with dotnetbridge - but am having trouble with the .NET version issue. Sometimes it runs but sometimes I get:

Could not load file or assembly 'file:///f:\wconnect\hasher.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

...even though the project's targeted framework is .NET 3.5 which should match the 3.5 runtimes loaded on my system. My bridge object shows its .NET version as 2.0.50727.5456. I see there is an Init parameter to set the version but only for V2 or V4. (And it still shows the same 2.0 even after passing in V4.) How do I get it to consistently run with my 3.5 runtimes?

Or should I just upgrade to the 4.0 runtimes? Easy to do here, but that would mean my clients would also need 4.0, right?

--stein






Rick Strahl
West Wind Technologies

Making waves on the Web

from Maui, Hawaii

Viewing all articles
Browse latest Browse all 10393

Trending Articles