Failed to load file or assembly. The operation is not supported. (Exception from HRESULT: 0x80131515)

When I run CodedUI Test from a small Console tool via vstest.console.exe from a scheduled task, I sometimes see this error message on different PCs:

Error: Could not load file or assembly file: /// C: \ foobar.dll or one of its dependencies. The operation is not supported. (Exception from HRESULT: 0x80131515)

Why / what is this not supported?

+25
source share
5 answers

During my research, I discovered that this could happen when you downloaded the test in ZIP from the Internet, and the advice was to unblock the ZIP , but I copied the files over the network from my development system to the test PCs and the files were not locked.

Search more for error code 0x80131515 I found this answer on the MSDN forum .

So I edited the file

C: \ Program Files (x86) \ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ CommonExtensions \ Microsoft \ TestWindow \ vstest.console.exe.config

and added the entry <loadFromRemoteSources enabled="true" /> to the runtime and voilรก tag, the tests are performed without any problems from the scheduled task.

Perhaps this helps other users who are also facing this strange problem.

+32
source

enter image description here

Right-click on the Dll and unlock it.

+71
source

As stated earlier, the Zip file is blocked when downloading from an untrusted site. If you are sure that the site is reliable, you can prevent this by adding it to the list of trusted sites in Internet Explorer โ†’ Tool menu โ†’ Internet options โ†’ Security tab โ†’ Trusted sites . Future downloads will not be marked as blocked.

For locked files that have already been extracted, do this at the Powershell prompt to unlock all files in the current folder and subfolders:

 Get-ChildItem *.* -Recurse | Unblock-File 
+2
source

1) go to exe file, click on properties

2) press the unlock button

then it will be a word

0
source

This problem occurs when sgen.exe cannot write to your output assembly to generate a serialization assembly.

The reason may be that the file is read-only or is located on the UNC path.

To solve this problem, you have the following options.

  1. Copy your solution to the system local disk and create it.
  2. Use caspol.exe to provide full trust in the UNC path.
  3. Disable the "Create serialization assembly" option on the project properties assembly tab.

For more information, please visit http://bimbim.in/post/2010/09/06/SGEN-error-Could-not-load-file-or-assembly.aspx

reply from: bimbim.in

-1
source

Source: https://habr.com/ru/post/1238867/


All Articles