VB.NET - Is it possible to install a Service created with VS2010 VB Framework 4.0?

Asked By Frank Nogon on 12-Dec-12 02:38 AM
I have the following problem:
My service can not be installed, neither InstallUtil.exe still on the console with "SC create" service name ".
The error message reads:
When initializing the installation an exception occurred:
System.BadImageFormatException: The file or assembly 'file : C: \tracker\AVTTracker.exe "or one of its dependencies was not found.
The assembly is built by a runtime that is newer than the currently loaded runtime
and can not be loaded.

Environment: Win7 64bit, Visual Studio 2010, Framework 4.0, the service is compiled for x86 CPU.
(But I have also tried the Varinaten 'any' and 'x64' - without success.)

I get the message every time I compile with the Service Framework 4.0!
A test service from me is almost nonfunctional, there are no references or dependencies. The service create a file with only one line of text, and then ends.
This Test Service can also not install with Framework 4.0.
With Framework 3.5 it works.
and... i would like to use the Thraeding.tasks.task class - wich only supportet in Framework 4.0.

Do anybody know what´s the problem?

Thanks in advance
Greetings Frank
Robbe Morris replied to Frank Nogon on 12-Dec-12 02:18 PM
Does the framework version you compiled to exist on the machine you are running installutil.exe on?  It won't take care of installing the .NET framework version needed on that machine.  You need to do that yourself.
Frank Nogon replied to Robbe Morris on 13-Dec-12 05:45 AM
Hi Robbe,
thanks for your response.
And yes, all Frameworks from 2.0 up to 4.0 are installed (because it´s my developer machine).
And meantime I´ve installed a virtual win7 32 Bit machine with VMWare. All Frameworks and Updates - no change to install the Service with Framework 4.0.
I reconstructed the service and do not use the threading.Tasks class :-(
And so I can install it with the framework 3.5 .. and it´s work.
The question remains, is it not possible to install a service with framework 4.0?
And if.... why?

Greetings Frank
Robbe Morris replied to Frank Nogon on 13-Dec-12 08:07 AM
I run windows services under the .NET 4.0 framework but I don't use the Threading.Tasks class.  I'm starting my processes up on good old fashion threads.  Perhaps that will give you starting point to research.