1

I have a bunch of old VB.NET code, written originally on VS2005, and now I no longer have the license. I downloaded VS2010 free edition, and I just want to apply a relatively minor patch to an assembly/DLL. This particular DLL is being used by an existing Windows service (also written in VB.NET), and it's the server side implementation of a TCP remoting implementation.

So I need my patched code to be compatible with it all of this. When I naively tried to just build under VS2010, drop the DLL in place, and restart the service, it bails with some error about bad magic number or something. (I'm assuming because it's .NET 3.0 and the .NET 2.0 runtime has no idea how to deal with that).

Sorry for the long lead up, but I'm hoping there's some way in VS to say, 'build this as a .NET 2.0 assembly'. If this isn't possible, what are my options?

Kevin
  • 24,871
  • 19
  • 102
  • 158
  • The .NET 2.0 runtime works fine with .NET 3.0 assemblies. See the question about [the correct version numbers for C#](http://stackoverflow.com/questions/247621/what-are-the-correct-version-numbers-for-c) for more info (yes, it's a mess). You may be using libraries that are not in the 2.0 framework though. What's the version installed on the machine? – R. Martinho Fernandes Apr 13 '11 at 01:29
  • I'm guessing that this particular machine only has .NET 2.0 (obviously a problem)! The code isn't using anything for 3.0....its all old stuff and I'm just patching it. I don't want to get into installing 3.0 on the box since I'm not really getting paid for this work...I want to do the least amount possible to get the code back running. – Kevin Apr 13 '11 at 01:34
  • If your code doesn't use anything from 3.0/3.5, and the machine has 2.0 installed, it should work. Can you post the exact error you're getting? – R. Martinho Fernandes Apr 13 '11 at 01:37
  • 2
    its actually being compiled with 4.0 (just noticed that) and when I switch the runtime to use 2.0 everything works fine. – Kevin Apr 13 '11 at 01:55

1 Answers1

11

Yep go to "My Project" > "Compile" > "Advanced Compile Options" > "Target Framework" and change to ".NET Framework 2.0"

If this doesn't help, what is the actual error that you are getting?

Dan
  • 1,489
  • 12
  • 16
  • this sounds right...let me recompile/deploy....if everything works I'll mark your answer correct. – Kevin Apr 13 '11 at 01:36