Home Home    Forum    Blog    Feed your aggregator (RSS 2.0)

The Johnnynine Weblog - MSBUILD fails with sgen.exe error
A weblog by Johnny Hughes
 
 Wednesday, November 05, 2008

MSBUILD can give the following error message when compiling using a UNC path:

Error: Could not load file or assembly 'YOURASSEMBLYHERE' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)
              - Required permissions cannot be acquired.

C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1892,9): error MSB6006: "sgen.exe" exited with code 1.

This occurs when MSBUILD executes sgen.exe to build the optional XmlSerializers.dll assembly.

 

There are at least 3 ways to work around this error:

  1. Don't use a UNC path when compiling.
  2. In the project properties Build tab, Set 'Generate serialization assembly' to Off.
  3. Use caspol.exe to grant full trust to the UNC path. See Running a .Net application from a network share.
Wednesday, November 05, 2008 10:00:33 AM (US Mountain Standard Time, UTC-07:00)  #    Comments [0]   .NET | Technical  | 
Copyright © 2010 Johnny Hughes. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.