1
votes

We have a project that was built in the 3.5 version of the .Net Framework. We updated this project to be on the 4.0 version of the .Net Framework, and after we worked through all of the issues we noticed significant lag during the web service initialization.

We reverted the project back to the 3.5 Framework and that fixed our lag issues. We have a second project that relies on the use of 4.5 Framework dlls, therefore the second project needs to be built in the 4.5 version.

I know that this question has been asked before, and that the answer has always been that it isn't possible - but it IS possible, because we actually had this exact structure working following the steps available on the msdn forum below, but instead utilizing the <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"> runtime instead of the shown 4.0 only.

https://social.msdn.microsoft.com/Forums/vstudio/en-US/36b1a209-55d5-4323-91dc-0919ba2e1d03/using-methods-of-a-net-40-dll-by-net-35sp1-client?forum=clr

The issue is that we re-added a brand new service call to our webservice, and now when we attempt to access the project reference, it throws an error that it was accessing a project that was built on a newer version, giving the BadImageFormatException.

This exact error was discussed in the forum above, and stated that you needed to include the standard 2.0 reference AND the 4.0 reference in the <startup> section as <supportedRuntime>'s, and we have both of them in.

<startup>
    <supportedRuntime version="v2.0.50727"/>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>

I believe the issue is that the app.config is NOT loading both runtimes. I think that this is happening because if we switch the order of the supportedRuntimes like below....

<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    <supportedRuntime version="v2.0.50727"/>
</startup>

We begin to get errors anytime we attempt to access any 3.5 Framework references.

Now, the order the supportedRuntime's are added IS important - in the second set of code, it would prefer using the 4.5 version over the 3.5 Framework, but it SHOULD utilize the 3.5 Framework when it can, correct? I could be way off base here, but like I said we had this working -- unfortunately I didn't create a label for my codeset, so I can't just go back to the working codeset.

Can anyone think of anything I could be missing, or can anyone tell me if it's possible to specifically tell a set of code to utilize the 4.5 Framework in vb.Net?

1
"The issue is that we re-added a brand new service call to our webservice, and now when we attempt to access the project reference" This is confusing if you have a web service can't you just consume the endpoint as it is? Why are you building a web service and then trying to reference the project making it? You could just run it in an emulation mode and then set up a client to consume that instead. Trying to mix frameworks is a bad bad idea. You can usually reference a lower library to a higher one but the other way is just asking for trouble. - djangojazz

1 Answers

0
votes

I'm pretty sure you only want one supported runtime, at runtime at least, because only one runtime is loaded per process.

I am fairly confident as I use that configuration all the time with a 3.5 compiled DotLisp running on the latest framework so I can access the latest stuff in the DotLisp REPL.