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:
This problem occurs when sgen.exe is not able to get write access to your output assembly to generate serialization assembly.
Reason may be file is read only or it is on UNC path.
To resolve this issue you have following options.
For more info please visit http://bimbim.in/post/2010/09/06/SGEN-error-Could-not-load-file-or-assembly.aspx
answer replyed from: bimbim.in