1

We are trying to change a program from 32-bit to Any CPU. The program is in C# on .NET 3.5.

We are using Windows Task Scheduler COM wrapper.

The application compiles but when we try to run it on a 64-bit platform we are getting the following error:

BadImageFormatException: Could not load file or assembly 'Interop.TaskScheduler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4b71cab8d8e4499f' or one of its dependencies. An attempt was made to load a program with an incorrect format.

UPDATE: We created a new C# project in Any CPU, with TaskScheduler as a Reference, and with a very simple 2-line code (create an instance of TaskSchedulerClass and write a line to the console). We ran it on the same 64-bit platform, and it worked. However, the entire application is still not working. Thank you for your help.

user1516849
  • 55
  • 1
  • 8

3 Answers3

4

Since its a COM interop assembly, likely its only 32-bit. You have to keep your project as 32-bit.

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
0

your assemly can work only 32-bit, try find x64 version or alternative assembly

burning_LEGION
  • 13,246
  • 8
  • 40
  • 52
0

You can use WMI to schedule tasks via the standard managed interface to avoid using the COM component which restricts you to running as 32-bit.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa394399(v=vs.85).aspx

PhonicUK
  • 13,486
  • 4
  • 43
  • 62