I\'ve seen this: VSTS 2010 SGEN : error : Could not load file or assembly (Exception from HRESULT: 0x80131515) and none of the answers work. It also doesn\'t appear when I b
Try to unblock the file desbloquer.
This solved my problem.
I just needed to click "Unblock" in the file properties dialog in Windows Explorer.
This issue comes from the fact that some required files are on "untrusted location" such as the network or a shared location (even on the same computer). If the location is on the same computer, you can use the subst command line option.
The other answers here helped me to figure out this issue in PowerShell. Run Unblock-File <filename>
to allow it to be accessed by the script being executed.
None of these solutions worked for me. Instead, I found the way by making sgen.exe.config
via https://stackoverflow.com/a/3407750/516512
These solutions did not work for me either.
In my case, I was accessing files on a mapped network drive. The solution for me was to add my network IP address as a trusted drive by doing the following:
Not sure what made this work over all other options, but this is what solved the problem for me. All project and solutions now build with no issues.