相关疑难解决方法(0)

为什么我不能安装我的服务(运行时比加载的运行时更新)?

所以我在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.

有没有人有这个问题的经验?

.net c# windows-services failed-installation

24
推荐指数
5
解决办法
5万
查看次数

标签 统计

.net ×1

c# ×1

failed-installation ×1

windows-services ×1