本文介绍了全新安装VS2012和Code Contracts,静态分析失败,未找到SqlServerCe 3.5.1.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


 我已经安装了VS2012 Premium,并安装了最新版本的Code Contracts(1.4.51019.0)。我创建了一个非常简单的Windows商店类库和一个测试库。打开静态分析。当我点击构建时,我得到以下崩溃:

 1> CodeContracts:任务管理器不可用(无法在后台运行)。 
1> CodeContracts:ContractsStoreLibrary:运行静态契约分析。
1> CodeContracts:ContractsStoreLibrary:未处理的异常:System.IO.FileNotFoundException:无法加载文件或程序集'System.Data.SqlServerCe,Version = 3.5.1.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91'或其依赖项之一。该系统找不到指定的文件。
1> CodeContracts:ContractsStoreLibrary:at Microsoft.Research.CodeAnalysis.EntityCacheDataAccessor`5.GetMetadataOrNull(String key,Boolean silent)
1> CodeContracts:ContractsStoreLibrary:at Microsoft.Research.CodeAnalysis.CacheManager`11.TestCache()
1> CodeContracts:ContractsStoreLibrary:at Microsoft.Research.CodeAnalysis.CacheManager`11..ctor(IEnumerable`1 cacheAccessorFactories,Dictionary`2 methodAnalyses,Dictionary`2 classAnalyses,GeneralOptions options)
1> CodeContracts:ContractsStoreLibrary:at Microsoft.Research.CodeAnalysis.CacheManager`11.Create(IEnumerable`1 cacheAccessorFactories,Dictionary`2 dictionary,Dictionary`2 dictionary_2,GeneralOptions generalOptions)
1> CodeContracts:ContractsStoreLibrary:at Microsoft.Research.CodeAnalysis.Clousot.TypeBinder`9..ctor(String [] args,IDecodeMetaData`9 mdDecoder,IDecodeContracts`5 contractDecoder,IDictionary assemblyCache,Action`4 setTargetPlatform,IOutputFullResultsFactory`2 externalOutputFactory,IEnumerable` 1 cacheAccessorFactories)
1> CodeContracts:ContractsStoreLibrary:at Microsoft.Research.CodeAnalysis.Clousot.ClousotMain [Local,Parameter,Method,Field,Property,Event,Type,Attribute,Assembly](String [] args,IDecodeMetaData`9 mdDecoder,IDecodeContracts`5 contractDecoder,IDictionary assemblyCache,Action`4 setTargetPlatform,IOutputFullResultsFactory`2 outputFactory,IEnumerable`1 cacheAccessorFactories)
1> CodeContracts:ContractsStoreLibrary:at Microsoft.Research.CodeAnalysis.CCI1Driver.Main(String [] args,IOutputFullResultsFactory`2 outputFactory,IEnumerable`1 cacheAccessorFactories)
1> CodeContracts:ContractsStoreLibrary:at Microsoft.Research.CodeAnalysis.CCI1Driver.Main(String [] args)
1> CodeContracts:ContractsStoreLibrary:
1> CodeContracts:ContractsStoreLibrary:完成静态契约分析。

我猜这是安装程序文件中缺少的依赖项。


SQL CE 3.5下载似乎已经使这个错误消失了(找到)。




干杯,戈登。




解决方案

Hi,

  I've got VS2012 Premium, and the most recent version of Code Contracts (1.4.51019.0) installed. I create a very simple windows store class library and a test library. Turn on static analysis. When I hit build I get the following crash:

1>  CodeContracts: Task manager is unavailable (unable to run in background).
1>  CodeContracts: ContractsStoreLibrary: Run static contract analysis.
1>  CodeContracts: ContractsStoreLibrary: Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
1>  CodeContracts: ContractsStoreLibrary:    at Microsoft.Research.CodeAnalysis.EntityCacheDataAccessor`5.GetMetadataOrNull(String key, Boolean silent)
1>  CodeContracts: ContractsStoreLibrary:    at Microsoft.Research.CodeAnalysis.CacheManager`11.TestCache()
1>  CodeContracts: ContractsStoreLibrary:    at Microsoft.Research.CodeAnalysis.CacheManager`11..ctor(IEnumerable`1 cacheAccessorFactories, Dictionary`2 methodAnalyses, Dictionary`2 classAnalyses, GeneralOptions options)
1>  CodeContracts: ContractsStoreLibrary:    at Microsoft.Research.CodeAnalysis.CacheManager`11.Create(IEnumerable`1 cacheAccessorFactories, Dictionary`2 dictionary, Dictionary`2 dictionary_2, GeneralOptions generalOptions)
1>  CodeContracts: ContractsStoreLibrary:    at Microsoft.Research.CodeAnalysis.Clousot.TypeBinder`9..ctor(String[] args, IDecodeMetaData`9 mdDecoder, IDecodeContracts`5 contractDecoder, IDictionary assemblyCache, Action`4 setTargetPlatform, IOutputFullResultsFactory`2 externalOutputFactory, IEnumerable`1 cacheAccessorFactories)
1>  CodeContracts: ContractsStoreLibrary:    at Microsoft.Research.CodeAnalysis.Clousot.ClousotMain[Local,Parameter,Method,Field,Property,Event,Type,Attribute,Assembly](String[] args, IDecodeMetaData`9 mdDecoder, IDecodeContracts`5 contractDecoder, IDictionary assemblyCache, Action`4 setTargetPlatform, IOutputFullResultsFactory`2 outputFactory, IEnumerable`1 cacheAccessorFactories)
1>  CodeContracts: ContractsStoreLibrary:    at Microsoft.Research.CodeAnalysis.CCI1Driver.Main(String[] args, IOutputFullResultsFactory`2 outputFactory, IEnumerable`1 cacheAccessorFactories)
1>  CodeContracts: ContractsStoreLibrary:    at Microsoft.Research.CodeAnalysis.CCI1Driver.Main(String[] args)
1>  CodeContracts: ContractsStoreLibrary: 
1>  CodeContracts: ContractsStoreLibrary: Static contract analysis done.

I am guessing this is a missing dependency in the installer file.

The SQL CE 3.5 download seems to have made this error go away (found here).


Cheers, Gordon.


解决方案


这篇关于全新安装VS2012和Code Contracts,静态分析失败,未找到SqlServerCe 3.5.1.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 23:13