Visual Studio 2013 预览版,Google 测试运行器无法加载文件或程序集 F#。

3

在尝试为我的当前项目添加单元测试时,我遇到了适用于Visual Studio 2012和2013的Google Test Runner插件。但是,当我尝试使用它运行测试时,我遇到了以下错误:

------ Run test started ------
Found 2 tests, resolving symbols
Loading symbols from C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\tests.exe
Retrieving the COM class factory for component with CLSID {BCE36434-2C24-499E-BF49-8BD99B0EEB68} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
Running: C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\tests.exe --gtest_output=xml:C:\Users\MYUSER\AppData\Local\Temp\tmpB2DE.tmp 
Opened results from C:\Users\MYUSER\AppData\Local\Temp\tmpB2DE.tmp
Could not load file or assembly 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
   at FSharp.Data.RuntimeImplementation.XmlOperations.GetChildrenArray(XmlElement value, String nameWithNS)
   at FSharp.Data.RuntimeImplementation.XmlOperations.ConvertArray[R](XmlElement xml, String nameWithNS, Func`2 f)
   at GoogleTestRunner.ResultParser.getResults(IMessageLogger logger, String outputPath, IEnumerable`1 testCases)
   at GoogleTestRunner.GoogleTestExecutor.runOnce(IFrameworkHandle framework, Boolean debug, FSharpList`1 cases, String executable, Boolean runAll)
   at GoogleTestRunner.GoogleTestExecutor.runTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle framework, Boolean runAll)
No test is available in C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\tests.exe. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.
========== Run test finished: 0 run (0:00:04.7380291) ==========

我不太熟悉F#,也不知道出了什么问题以及如何解决,网页上写着它与Visual Studio 2013兼容。测试可以被正确发现并在文本资源管理器中查看,但是无法运行。 编辑:有时编译后我会遇到这个问题:
------ Discover test started ------
GoogleTest: Does C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\MY PROJECT.exe match [Tt]est[s]{0,1}.exe: false
GoogleTest: Does C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\Tests.exe match [Tt]est[s]{0,1}.exe: true
Found 2 tests, resolving symbols
Loading symbols from C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\Tests.exe
Retrieving the COM class factory for component with CLSID {BCE36434-2C24-499E-BF49-8BD99B0EEB68} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
GoogleTest: Does C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\WorldServer.exe match [Tt]est[s]{0,1}.exe: false
========== Discover test finished: 2 found (0:00:00.2372256) ==========

你是否已安装了 F#?我不确定它是否默认安装在 VS 2012 中。虽然我认为它在 VS 2013 中是默认安装的。 - John Palmer
在新项目窗口中,它显示我可以创建一个 F# 项目,因此我认为它已安装。 - Layl Conway
自从VS 2010以来,“Professional”及更高版本的SKUs中默认包含了F#。 - latkin
@LaylConway 如果我们中的任何一个回答了您的问题,通常习惯将答案标记为“已接受”,以供后来者参考。如果我们都没有回答您的问题,也许您可以提供一些额外的信息? - Onorio Catenacci
两个回答都没有解决我的问题。正如我在Richard的回答下评论中所说,我并不是试图构建一个包含F#代码的项目。我正在尝试使用一个用F#编写的Visual Studio插件。 - Layl Conway
找到了解决方案,我确实缺少了 F# 3.0 运行时...但是这个运行时并不存在独立的版本,呃!不过安装这个工具集解决了我的问题,如果你能在你的问题中附上这个链接,我会将其标记为答案。 - Layl Conway
2个回答

3

尝试安装此 NuGet 包:

http://www.nuget.org/packages/FSharp.Core.3/

我认为你只需要F#运行时。
编辑:根据Layl Conway的说法,这是实际上需要允许Google测试运行器运行的内容: F# Tools for Visual Studio Express 2012 for Web 编辑2:为了完整起见,还有这篇博客文章(来自另一个SO问题的答案):

http://www.heartysoft.com/build-fsharp-3-on-build-server-without-vs

对于急切的人:

点击直接下载链接(如果您太忙了,可以点击http://go.microsoft.com/fwlink/?LinkId=261286),下载VWD_FSharp.msi,文件大小仅为7.55MB,不包括Azure工具、VS和其他内容。构建可用,宇宙又恢复正常了。


安装"适用于Web的Visual Studio Express 2012的F#工具"可以解决与VS 2015相同的问题! - singidunumx

0
FSharp.Core,版本=4.3.0.0
这是与VS2012和F# 3.0一起提供的版本。带有F# 3.1的VS2013具有FSharp.Core V4.3.1.0。
确保您的F#项目的项目设置已设置为使用正确且一致的F#运行时版本。

1
这不是我的项目,我正在尝试在一个包含Google测试单元测试的本地C++项目上运行Google测试运行器插件。 - Layl Conway

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接