This article is a mirror article of machine translation, please click here to jump to the original article.

View: 17569|Reply: 0

[Source] Exception occurred while initializing the installation

[Copy link]
Posted on 2/29/2016 2:17:11 PM | | |
Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\MyPr
ojects\ProxyService\ProxyInstaller\bin\Debug\ProxyInstaller.exe' or one of its d
ependencies. This assembly is built by a runtime newer than the currently loaded
runtime and cannot be loaded..


I installed Windows services with the command line and got the above error:

The process I installed is as follows:

1。 Run--〉cmd: Open the cmd command box

2。 Locate the location of the InstallUtil.exe in the command line

InstallUtil.exe The default installation location is in C:/Windows/Microsoft.NET/Framework/v2.0.50727, so you need to locate it in cmd (cd C:/Windows/Microsoft.NET/Framework/v2.0.50727)

3。 Operation Commands:

1). Install service command: Enter the following command in the command line:

InstallUtil.exe  Path/WinServiceName.exe

where Path indicates the location of the ServiceName.exe, just press Enter


The reason for the installation failure is: my service is written in .net 4.0, and I can't use .net 2.0's InstallUtil to install the service, so I should use InstallUtil in the C:\Windows\Microsoft.NET\Framework\v4.0.30319 folder to install the service.


Not that way round, no. The .NET 4 CLR can load .NET 2 assemblies (usually - there are a few exceptions for mixed-mode assemblies, IIRC), but not vice versa.

You'll either have to upgrade the .NET 2 project to .NET 4, or downgrade the .NET 4 project to .NET 3.5 (or earlier).






Previous:WebKit.net the solution to the exception WebKitBrowser.dll
Next:System.Security.SecurityException: The source was not found, but some or all ...
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com