0

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

 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通常是由某种不良清单引起的。有人可以在这里帮助我吗?

4

1 回答 1

2

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

于 2010-08-23T21:59:02.583 回答