我们最近将我们的C#项目从.NET 3.5更新到了4.0。我们在本地机器和CC.NET上运行Gendarme,在更新了我们所有的项目后,Gendarme在我们的一个程序集上得到了这个错误(打开了日志):
An uncaught exception occured. Please fill a bug report at https://bugzilla.novell.com/
Rule: Gendarme.Rules.Globalization.SatelliteResourceMismatchRule
Target: Core.UI, Version=27.0.0.0, Culture=neutral, PublicKeyToken=null
Stack trace: System.IO.FileNotFoundException: Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, BooleanloadTypeFromPartialName)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError)
at System.Resources.ResourceReader.FindType(Int32 typeIndex)
at System.Resources.ResourceReader.DeserializeObject(Int32 typeIndex)
at System.Resources.ResourceReader.LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode)
at System.Resources.ResourceReader.GetValueForNameIndex(Int32 index)
at System.Resources.ResourceSet.ReadResources()
at Gendarme.Rules.Globalization.SatelliteResourceMismatchRule.CheckSatelliteResource(EmbeddedResource mainResource, EmbeddedResource satelliteResource, IMetadataTokenProvider satelliteAssembly)
at Gendarme.Rules.Globalization.SatelliteResourceMismatchRule.CheckSatelliteAssembly(AssemblyDefinition satellite)
at Gendarme.Rules.Globalization.SatelliteResourceMismatchRule.CheckAssembly(AssemblyDefinition assembly)
at Gendarme.Framework.Runner.OnAssembly(RunnerEventArgs e)
at Gendarme.ConsoleRunner.OnAssembly(RunnerEventArgs e)
at Gendarme.Framework.Runner.Run()
at Gendarme.ConsoleRunner.Run()
at Gendarme.ConsoleRunner.Execute(String[] args)
=== Pre-bind state information ===
LOG: DisplayName = System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///c:/sd/trunk/bin/prod/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Post-policy reference: System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///c:/sd/trunk/bin/prod/System.Drawing.DLL.
LOG: Attempting download of new URL file:///c:/sd/trunk/bin/prod/System.Drawing/System.Drawing.DLL.
LOG: Attempting download of new URL file:///c:/sd/trunk/bin/prod/System.Drawing.EXE.
LOG: Attempting download of new URL file:///c:/sd/trunk/bin/prod/System.Drawing/System.Drawing.EXE.多台计算机上出现相同的错误。我删除了引用,并在没有更改的情况下重新添加了它。如果我运行我们的程序,这个程序集中的控件加载和工作没有任何问题。我们在这个程序集中有单元测试,NUnit和PartCover也运行得很好。
我注意到它使用的是Framework64\v2.0.50727文件夹中的machine.config文件,但我看不出这个程序集与其他程序集有什么不同。这会是一个问题吗?我还能尝试什么呢?
发布于 2011-07-16 21:16:04
一般来说,你正在分析的框架的版本并不重要,例如Gendarme支持所有的版本。
发布于 2011-11-23 04:26:56
仅供参考:我遇到了和你一样的问题;不过,通过安装最新的快照版本https://github.com/spouliot/gendarme/downloads (目前在gendarme-2.11-snapshot-20110305-win32-setup.zip)上),我能够在声纳中运行宪兵
确保在您的sonar-project.properties文件中设置安装路径:
sonar.gendarme.installDirectory=C:/Program Files/Gendarme/
https://stackoverflow.com/questions/6590348
复制相似问题