Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I successfully run secannotate.exe on a library that depends on a Portable Class Library?
    text
    copied!<p>I am working on <a href="https://code.google.com/p/autofac/" rel="nofollow">the Autofac project</a> trying to convert all of our common logic into <a href="http://msdn.microsoft.com/en-us/library/gg597391.aspx" rel="nofollow">Portable Class Libraries</a> and adding platform-specific libraries for specific functionality.</p> <p>My development machine is Windows 8 Enterprise (64-bit) and I have VS 2012 Ultimate installed with all the trimmings. I don't have any previous .NET framework stuff installed, any additional tools, or any extra PCL-specific tooling. <strong>It's a clean, new VM with just base stuff.</strong> Everything builds and tests run fine in this configuration.</p> <p>When I attempt to run <a href="http://msdn.microsoft.com/en-us/library/dd997356.aspx" rel="nofollow">secannotate.exe</a> on a .NET 4.5 (full profile) library that depends on one of the Portable Class Libraries, <strong>I get an error indicating I need mscorlib 2.0.5.0</strong>.</p> <p>Here is an example error. The PCL is Autofac.dll; the .NET 4.5 full profile library is Autofac.Configuration.dll.</p> <pre><code>Error running annotator: Could not find referenced assembly 'Assembly(Name=mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)'. Ensure that the reference paths and assemblies are setup correctly. Microsoft (R) .NET Framework Security Transparency Annotator 4.0.30319.17929 Copyright (C) Microsoft Corporation. All rights reserved. Loaded assembly 'Autofac.Configuration' from 'C:\dev\opensource\autofac\trunk\build_output\bin\net40\Autofac.Configuration.dll'. Resolving assembly 'Assembly(Name=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)'. Loaded assembly 'mscorlib' from 'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Loaded referenced assembly from 'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Using core assembly: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' from 'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Assembly 'Autofac.Configuration' is using transparency model 'Level 2'. Assembly 'mscorlib' is using transparency model 'Level 2'. Loaded assembly 'Autofac' from 'C:\dev\opensource\autofac\trunk\build_output\bin\net40\Autofac.dll'. Resolving assembly 'Assembly(Name=mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)'. at Microsoft.Security.Tools.CciHostEnvironment.ResolvingAssemblyReference(IUnit referringUnit, AssemblyIdentity referencedAssembly) at Microsoft.Security.Tools.CciHostEnvironment.LoadCoreAssembly() at Microsoft.Security.Tools.CciHostEnvironment..ctor(ISecAnnotateHost host, String rootAssemblyPath) at Microsoft.Security.Tools.SecAnnotate.LoadInputAssemblies() at Microsoft.Security.Tools.SecAnnotate.AnnotateAssemblies() at Microsoft.Security.Tools.SecAnnotate.Main(String[] args) </code></pre> <p>The Autofac Portable Class Library targets:</p> <ul> <li>.NET 4.0</li> <li>Silverlight 5</li> <li>.NET for Windows Store apps</li> </ul> <p>You can replicate the issue by creating a new/empty PCL targeting those things and build it. You'll see it references mscorlib 2.0.5.0.</p> <p>Some searching leads me to believe that this is a reference to the old Silverlight assembly version, but PCL projects don't have specific version references so I can only imagine this is getting put in by the VS 2012 PCL tools. Other people seem to have fixed similar issues by installing a .NET framework update that came out before VS 2012. <strong>I can't actually find mscorlib 2.0.5.0 anywhere on my machine.</strong></p> <p>Looking in dotPeek at the Autofac.dll assembly I built, I see it references:</p> <ul> <li>mscorlib 2.0.5.0</li> <li>System 2.0.5.0</li> <li>System.ComponentModel.Composition 2.0.5.0</li> <li>System.Core 2.0.5.0</li> </ul> <p>And, again, it's just a PCL project, not directly referencing anything. Literally - there's <strong>not a single reference line</strong> in the .csproj file.</p> <p><strong>How do I resolve this secannotate problem?</strong> Is there something additional I need to install? Is there a parameter I should be adding to the secannotate command line?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload