Note that there are some explanatory texts on larger screens.

plurals
  1. POInstall a Service as x64
    primarykey
    data
    text
    <p>I have developed a service on a 64 bit system using Visual Studio 2010. The service is just a skeleton that accesses the Start and Stop methods in a secondary library. The library accesses a 64 bit COM object, and must be built as x64. The COM object is a dll that was built separately as x64 and tested in a 64-bit environment. I have an installer that sets up the project and installs the service through a custom action.</p> <p>I debug the code with a test app that bypasses the service, and so I can confirm that the library the service is accessing is working correctly. </p> <p>The problem I am having is a BadImageFormatException when installing. I am using an installer with a target platform of x64. If I build everything as x64, I get the following message:</p> <pre><code>Error 1001. Exception occured while initializing the installation: System.BadImageFormatException. Could not load file or assembly... or one of its dependencies. An attempt was made to load a program with an incorrect format. </code></pre> <p>If I set the service to build as Any CPU, the installation works, and the service can access the library, but the COM object cannot be found. The installation will also work if I remove the custom action that installs the service. If I then try to install the service manually using installutil, I get the same error message as above.</p> <p>Below is a list of the libraries I am using in the service.</p> <pre><code>using System; using System.Diagnostics; using System.ServiceProcess; using System.Text; using System.Threading; using MAPIMail; using MAPIMail.Logging; </code></pre> <p>Note that the MAPIMail project is being built as x64.</p> <p>Does anyone have an idea about why I cannot install the service specifically as x64 when it installs fine as Any CPU on an x64 system. I appreciate any and all suggestions.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload