An attempt was made to load an assembly from a network location

We ran into our first real issue with our new TeamCity build server on Friday afternoon. We ported an old project from Vault into GitHub and then migrated the build script from CruiseControl.Net over to TemaCity. This was the 8th project that I had migrated so I did not expect to have any issues. Once the migration was complete, I hit the Run button in TeamCity to verify that the build would work. A few minutes later, I received the following email:

Compilation errors

SGEN Could not load file or assembly 'file://\\NETWORKPATH\AjaxMin.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

Some Googling provided a number of different solutions, the most popular of which was to "unblock" the DLL. None of them seemed to work. I updated the server and rebooted but still no luck. I found this post on SO and followed the solution provided by Martin Hyldahl:

To fix your issue just find the location of sgen.exe and create a sgen.exe.config in the same folder with following contents:

<configuration> <runtime> <loadFromRemoteSources enabled="true" /> </runtime> </configuration>

Creating this file and adding it to the C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools directory worked!

Thank God for StackOverflow!