InstallUtill of GCC编译.exe接收System.BadImageFormatException

时间:2010-08-23 21:53:27

标签: windows-services service installutil badimageformatexception

我试图在Windows中使用GCC编译的.exe作为服务。根据我的研究,我应该做:

 C:\Windows\Microsoft.net\Framework\v2.0.50727\InstallUtil.exe [program name] 

虽然当我尝试这样做时,我会收到一条消息:

Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\Users\Chris\Documents\Visual Studio 2010\Projects\Setup4\Setup4\Service.exe' or one of its dependencies. The module was expected to contain an assembly manifest..

我有一种感觉,这是因为该程序是使用GCC编译的,并且确实使用了一些.a文件进行编译。

从我看到的 System.BadImageFormatException 通常是由某种不良清单引起的。有人能帮助我吗?

1 个答案:

答案 0 :(得分:2)

InstallUtil用于将.Net应用程序安装为服务。除非GCC可以生成托管程序集,否则您应该使用sc.exe代替为您的应用程序创建Windows服务条目。