我正在努力the Autofac project試圖將我們所有的通用邏輯轉換爲Portable Class Libraries,併爲特定功能添加平臺特定的庫。如何在依賴於可移植類庫的庫上成功運行secannotate.exe?
我的開發機器是Windows 8 Enterprise(64位),我的VS 2012旗艦版安裝了所有的配件。我沒有安裝任何以前的.NET框架的東西,任何額外的工具,或任何額外的PCL特定的工具。 這是一個乾淨的,只有基本東西的新VM。一切構建和測試運行良好在這種配置。
當我試圖運行依賴於便攜式類庫中的一個.NET 4.5(完整的個人資料)庫secannotate.exe,我得到一個錯誤,表示我需要MSCORLIB 2.0.5.0。
下面是一個示例錯誤。 PCL是Autofac.dll; .NET 4.5完整配置文件庫是Autofac.Configuration.dll。
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)
的Autofac便攜式類庫目標:
- .NET 4.0
- 的Silverlight 5
- .NET的Windows Store應用程序
您可以通過創建複製問題一個新的/空的PCL針對這些東西並構建它。你會看到它引用mscorlib 2.0.5.0。
一些搜索引導我相信這是對舊的Silverlight程序集版本的引用,但PCL項目沒有特定的版本引用,所以我只能想象這會被VS 2012 PCL工具加入。其他人通過安裝在VS 2012之前發佈的.NET框架更新似乎修復了類似的問題。我實際上找不到我的機器上任何地方的mscorlib 2.0.5.0。
在Autofac.dll組裝我建展望dotPeek,我看到它引用:
- 的mscorlib 2.0.5.0
- 系統2.0.5.0
- System.ComponentModel.Composition 2.0.5.0
- System.Core程序2.0.5.0
並再次,它只是一個PCL項目,而不是直接引用任何物品ING。字面意思 - 在.csproj文件中有不是單個參考線。
如何解決此secannotate問題?有什麼額外的我需要安裝?有沒有我應該添加到secannotate命令行的參數?
please fast =),我們不能在項目中使用PCL。在生產環境中,沒有辦法引用這個2.0.5.0框架程序集... – benwasd
我已經更新了答案。 –
這隻修復了開發機器上的驗證。沒有?在客戶端只有.NET 4.0安裝我的.NET 4.0目標PCL程序集仍然無法加載.. – benwasd