title: why does SGEN.EXE require write access to referenced assemblies?
body: <p>i have a project that links with ICSharpCode.SharpZipLib.dll (the dll itself doesn't matter).  one of the project outputs is a serialization assembly.  this output is generated by sgen.exe, a microsoft tool.  all of this works as expected until i check in the SharpZipLib to my source code repository, which makes it read-only.  i'm not building the SharpZipLib assembly myself, so it makes sense for me to have this binary checked in.  however, when i build, sgen fails with an "access denied" error.</p>
  
  <p>here is a simplified command to reproduce:</p>
  
  <pre><code>sgen.exe /assembly:.\MyProject.dll /proxytypes /reference:.\ICSharpCode.SharpZipLib.dll
  </code></pre>
  
  <p>here is the resulting error:</p>
  
  <pre><code>SGEN : error : Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.85.1.271, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. Access is denied.
  Done building project "MyProject.csproj" -- FAILED.
  </code></pre>
  
  <p>again, this error does not occur when the read-only flag is not set on ICSharpCode.SharpZipLib.dll.  i have a philosophical objection to checking out files during a build, but there seems to be no way around it.  sgen.exe fails if any referenced assemblies are read-only.</p>
  
  <p>it should be noted that sgen.exe does not modify any referenced assemblies, so why does it open them for read/write?</p>
  
  <p>i could disable the generation of the serialization assembly, but it is a desirable optimization.</p>
  
  <p>note:  i am using rational clearcase with dynamic views.  i don't think this is relevant, but i include it for completeness.</p>