Vb6 / Dot Net 2.0 Interop

This forum is now locked, since Gold Support is no longer offered.

Moderator: SourceGear

Locked
chris.bradley
Posts: 30
Joined: Tue Aug 15, 2006 6:17 pm

Vb6 / Dot Net 2.0 Interop

Post by chris.bradley » Tue Aug 15, 2006 7:14 pm

I'm having an interesting problem with Vault running alongside the VB6 ide. The problem I have is that my VB6 app uses Com Interop to call out to a dot net 2.0 dll I've written to do some work. If I remove source control on my vb6 project life is wonderfull. I can make my Com Interop call, the dot net runtime picks up (that's Framework\v2.0\mscoree.dll), and re-routes my call to our dll. Like I said, life is wonderfull.

But... if my VB6 project has source control enabled it appears to get a little messy. The first Com Interop call that is made ends up being to the Vault Client - which I think is compiled with 1.1. Instead of it loading dot net runtime v2 to handle the Com Interop calls, it loads runtime v1.1 (Framework\v1.1\mscoree.dll). And then later on when I try to call into my dll, framework 1.1 tries to make sense of my dot net 2 assembly and explodes.

It took me a long time to figure out what's happening here and I don't know that I'm doing it justice but basically I think I need the Vault Client that's called by the VB6 IDE to run under dot net 2 instead of 1.1.

Any idea's? Does this even make sense?

Thanks in advance,
Chris

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Post by lbauer » Wed Aug 16, 2006 7:58 am

Yes, it makes sense. It's only possible for one version of the .NET Framework to be loaded at one time. By default the Vault IDE client loads .NET Framework 1.1 (except when integrating with VS 2005, which uses 2.0). So you will run into problems if you are coding agains the .NET 2.0 Framework.

I'll check with our IDE developer to see if it is possible to choose which version of the .NET Framework to load.
Linda Bauer
SourceGear
Technical Support Manager

chris.bradley
Posts: 30
Joined: Tue Aug 15, 2006 6:17 pm

Post by chris.bradley » Wed Aug 16, 2006 1:24 pm

Thanks Linda - I'm thinking there's probably a work around either with some registry entry or with some kind of config file but I have no idea what it is.

In the mean-time we're having to check out files, remove source control, and then re-enable it when we're ready to check in... really slows us down.

davidt
Posts: 44
Joined: Thu Aug 12, 2004 7:43 am

Post by davidt » Fri Aug 18, 2006 9:00 am

While other workarounds are being considered, I thought I'd mention this: Once a given version of the CLR is loaded into a process, the process stays with that version.

So in practice (and maybe you already do this), you could

1. Start VB6 without source control
2. Load your project and run it once (gets CLR 2.0 loaded)
3. Turn on source control, and check in/out and run the project as much as you like until you need to exit VB6.

Hope this helps.
David Thompson
JELD-WEN, inc.

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Post by lbauer » Fri Aug 18, 2006 9:13 am

You might be able to do this with a configuration file:

You will need to create a file called "vb6.exe.config."

This file is not installed with the Vault clients. Copy VaultGUIClient.exe.config to create vb6.exe.config in the folder where the Vault client executables are installed, usually C:\Program Files\SourceGear\Vault Client.

If that doesn't work, copy the vb6.exe.config file to the same directory as vb6.exe (C:\Program Files\Microsoft Visual Studio\VB98).

Then, add information about the .NET Framework version to use at startup. It should look like this:

Code: Select all

<configuration>
<startup>
<requiredRuntime version="v2.0.50727" safemode="true"/>
</startup>
<system.net>
Last edited by lbauer on Tue Apr 29, 2008 12:30 pm, edited 1 time in total.
Linda Bauer
SourceGear
Technical Support Manager

chris.bradley
Posts: 30
Joined: Tue Aug 15, 2006 6:17 pm

Post by chris.bradley » Fri Aug 18, 2006 9:42 am

Thanks Linda - works like a charm! You've made my day!

Chris

Locked