Wednesday, July 5, 2017

SOLVED: System.IO.FileLoadException exception by unblocking the files


When I was trying to uninstall windows service using InstallUtil.exe (This can also happen when you try to install a windows service). I was getting an error. Please read the complete story.

The command I was trying was,

installutil -u  SearchIndexService.exe

The error was,

Microsoft (R) .NET Framework Installation utility Version 4.0.30319.17929
Copyright (C) Microsoft Corporation.  All rights reserved.

Exception occurred while initializing the installation:
System.IO.FileLoadException: Could not load file or assembly 'IDM365SearchIndexService.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515).

After lot of research on internet I have found following solution, You need to run following power shell command for the folder where you want to do the operation.

 get-childitem -recurse *.* | Unblock-File

The command simply unblocks the file.

You can verify the problem & solution by looking at the properties of the target file. it should show something as highlighted in following image.



After you run the command   get-childitem -recurse *.* | Unblock-File it should disappear.
After all this exercise you should be able to install/uninstall windows services.

Thanks
Happy Programming :)



No comments: