1

I have an old .net app, a mod loader for a game. I wanted to modify it to support a similar game, but get the assembly error when i switch out the included dll with a newer one and try and load a mod script.

is there a way to make the app compatible with the newer dll?

i contacted the original author of the app but they didn't want to update an old project. also i don't have the source.

both dlls are v 1.0.0.0, but one is built for net 2.0 and the newer one net 4.0

the excutable is built for net 2.0, so cff explorer says, although reflector says it's 3.5.

any of this make sense?

Paul R
  • 208,748
  • 37
  • 389
  • 560
slarlac249
  • 11
  • 1

2 Answers2

0

If I understood correctly, you are trying to load a .NET Framework 4.0 assembly in a .NET Framework application. Trying to achieve this seems to be quite far from trivial and before attempt this, I would try the following:

if the old solution is not obfuscated and you do not violate some copyright statement, I would try to use reflector (or its free brother, Telerik decompiler) to decompile the old assemblies, create a project and compile them against .NET Framework 4.0.

Community
  • 1
  • 1
Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164
  • forgot to mention my knowledge of programming is rather limited. i have already decompiled it and tried to rebuild it in vs2010 but it always throws up a big list of errors on compiling and thus doesn't build anything, so i'm not sure what's up. here's a screen of the app error, if that's of any use http://i.imgur.com/etxsK4G.jpg – slarlac249 Apr 03 '16 at 18:25
  • Did you change target framework of the project(s) to .NET framework 4.0? – Alexei - check Codidact Apr 03 '16 at 19:40
  • Can you try to use debug assemblies and attach to process to see the inner exception of TypeLoadException? – Alexei - check Codidact Apr 03 '16 at 19:42
0

That means that your project is build to target a lower framework version (like 1.0, 2.0, 3.5, or 4.0) and you're trying to reference an assembly built with a newer framework version. You can't do that.

If you need to reference code built in a later framework version then you have to change your project to target that framework version or later. If you have to do that then you might as well target 4.5 since it's much more recent.

That change to target a newer framework version can be really easy but sometimes it creates other reference issues that you need to work out. Hopefully not, so you can cross that if you come to it.

Scott Hannen
  • 27,588
  • 3
  • 45
  • 62
  • i guess i can't do anything as i haven't got the original source and it won't rebuild in vs after decompiling due to errors that go over my head. :( – slarlac249 Apr 03 '16 at 18:35