所以我在C#中构建了一个服务,我正在尝试使用以下命令来安装它:
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\installutil.exe MyService.exe >> installLog.txt
Run Code Online (Sandbox Code Playgroud)
它失败.当我查看installLog.txt时,我得到了这个:
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.3053
Copyright (c) Microsoft Corporation. All rights reserved.
Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\MyService.exe' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded..
Run Code Online (Sandbox Code Playgroud)
相同的方法适用于安装不同的组件.我觉得可能是因为失败的那个是为.NET 4.0编写的,而有效的是3.5.
有没有人有这个问题的经验?