【发布时间】:2010-12-28 08:45:34
【问题描述】:
我有一个我正在测试的 DLL,它链接到一个我认为对 AssemblyCulture 无效的 DLL。该值为“中性”(注意大写“N”),而我正在测试的 DLL 以及我项目中的所有其他 DLL 的值为“中性”(因为它们指定了 AssemblyCulture(""))。
当我尝试部署 链接 到问题 DLL 的 DLL 时,我在 VSTS 中收到此错误:
Failed to queue test run '...': Culture is not supported.
Parameter name: name
Neutral is an invalid culture identifier.
<Exception>System.Globalization.CultureNotFoundException: Culture is not supported. Parameter name: name
Neutral is an invalid culture identifier.
at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
at System.Globalization.CultureInfo..ctor(String name)
at System.Reflection.RuntimeAssembly.GetReferencedAssemblies(RuntimeAssembly assembly)
at System.Reflection.RuntimeAssembly.GetReferencedAssemblies()
at Microsoft.VisualStudio.TestTools.Utility.AssemblyLoadWorker.ProcessChildren(Assembly assembly)
at Microsoft.VisualStudio.TestTools.Utility.AssemblyLoadWorker.GetDependentAssemblies(String path)
at Microsoft.VisualStudio.TestTools.Utility.AssemblyLoadWorker.GetDependentAssemblies(String path)
at Microsoft.VisualStudio.TestTools.Utility.AssemblyLoadStrategy.GetDependentAssemblies(String path)
at Microsoft.VisualStudio.TestTools.Utility.AssemblyHelper.GetDependentAssemblies(String path, DependentAssemblyOptions options, String configFile)
at Microsoft.VisualStudio.TestTools.TestManagement.DeploymentManager.GetDependencies(String master, String configFile, TestRunConfiguration runConfig, DeploymentItemOrigin dependencyOrigin, List`1 dependencyDeploymentItems, Dictionary`2 missingDependentAssemblies)
at Microsoft.VisualStudio.TestTools.TestManagement.DeploymentManager.DoDeployment(TestRun run, FileCopyService fileCopyService)
at Microsoft.VisualStudio.TestTools.TestManagement.ControllerProxy.SetupTestRun(TestRun run, Boolean isNewTestRun, FileCopyService fileCopyService, DeploymentManager deploymentManager)
at Microsoft.VisualStudio.TestTools.TestManagement.ControllerProxy.SetupRunAndListener(TestRun run, FileCopyService fileCopyService, DeploymentManager deploymentManager)
at Microsoft.VisualStudio.TestTools.TestManagement.ControllerProxy.QueueTestRunWorker(Object state)</Exception>
即使我没有链接到 DLL(在我的 VSTS 包装测试或 NUnit 测试中),只要我将它添加到我的 GenericTest 文件中(我正在包装 NUnit 测试),我就会得到那个异常.
我们没有问题DLL的源代码,而且它也是代码签名的,所以我无法通过重新编译来解决这个问题。
有没有办法跳过部署 DLL DeploymentItem 的依赖项,修复或禁用文化检查,或者通过复杂的方式解决这个问题(可能以某种方式嵌入程序集)?有没有办法覆盖文化的价值,而不是破解 DLL(并删除代码签名以便破解工作)?也许有一个外部清单?
任何正确的解决方案都必须在不对生产代码进行奇怪更改的情况下运行。例如,我们不能部署被黑的 DLL。它还必须允许对 DLL 进行代码覆盖检测。
附加说明:在编译链接到问题 DLL 的测试 DLL 时,我确实收到了链接器警告,但这并没有破坏除 VSTS 之外的任何东西,并且已经发布了多个版本。
【问题讨论】:
标签: visual-studio-2010 tfsbuild mstest cultureinfo