VS2015 CTP6不会发现单元测试(ReSharper的确实发现其中的一些) [英] VS2015 CTP6 does not discover unit tests (resharper does discover some of them)

查看:814
本文介绍了VS2015 CTP6不会发现单元测试(ReSharper的确实发现其中的一些)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

修改2016年5月4日:



由于我们现在早已过了VS2015测试版,我当时的具体问题是可能不再相关。但似乎这样的问题是仍然得到了一年了不少命中我张贴后,我将分享,因为当时的一些经验教训的希望,它可以帮助一些人有类似的问题。与VS扩展和升级的问题有各种的口味,毕竟。




  1. 的VS MEF组件缓存,位于%LOCALAPPDATA%\Microsoft\VisualStudio\14.0\ComponentModelCache 可与扩展问题的常见来源。



只需关闭VS并清除该文件夹。缓存会当你再次启动VS自动重建。这里有一个扩展,它可以让你从菜单中做到这一点,这是典型的第一件事我试试今天,当我遇到VS任何形式的问题之一(它可以帮助经常)的https://visualstudiogallery.msdn.microsoft.com/22b94661-70c7-4a93-9ca3-8b6dd45f47cd



删除 OBJ 您在同一时间的解决方案的文件夹可以帮助以排除任何的不一致所造成的损坏MEF组件缓存构建文物。




  • 更新VS和您的扩展。



  • 由于操作简单,明显,因为它可能看起来,更新到Visual Studio和/或扩展可能是最经常被忽视的解决方案一常见的问题。
    仔细检查工具 - > 扩展和更新 - > 更新 - > 产品更新 Visual Studio库来看看你是否错过了什么,并安装任何更新在继续与潜在浪费了很多时间了。




  • 检查与.NET Framework的安装


    微软已经发布了这一个整洁的小工具,它帮助我解决更新/安装不同版本之后所发生的问题或两个。以错误的方式.NET框架:
    https://www.microsoft.com /en-us/download/details.aspx?id=30135




  • 检查与Windows的问题更新,路径和/或注册表



  • 这尤其适用于那些没有被重新安装很长一段时间,并已通过一些机器早期版本的Windows 10和DNX / DNVM的。他们可能是无数的问题的原因,如留给框架无效引用您的注册表和/或路径产品重命名后,这一点与 .NET 4.5.3 到 .NET 4.6 KRE DNX



    在某些情况下,一个新的安装可能只是解决大多数/所有这些类型的问题一气呵成大部分时间有效的方式。一,我重新安装了一切,当VS2015出去BETA,要摆脱所有的杂波从频繁的更新和变化。



    虽然稍微出了问题的范围,在某些情况下,下面的命令序列可帮助修复(或至少识别)在Windows一般在Visual Studio共同的问题,因而还




    • DISM /在线/清理图像/ restorehealth (检查,如果有必要,修复您的Windows组件店)


    • SFC / SCANNOW (使用校验方式来寻找核心的Windows DLL和注册表项损坏)




    他们可能并不总是能够修复它们检测的问题。这可与OS潜在的问题可能使其无法与VS解决问题,如果不首先解决的一个信号。






    原题:



    从昨天开始,我的Visual Studio的测试资源管理器不会发现任何我的项目的测试。它没有显示建筑物,无论是后绿装吧。



    当我去到Visual Studio测试资源管理器,然后单击运行全部,或当我右击任何测试方法并选择运行测试,我得到我的输出窗口中以下内容:



    无法加载文件或程序集Microsoft.VisualStudio .Web.ProjectSystem,版本= 14.0.0.0,文化=中性公钥= b03f5f7f11d50a3a'或它的一个依赖。该系统找不到指定的文件。



    我在Windows 10 Pro的技术预览版运行Visual Studio 2015年CTP 6,建立10041.的。 NET Framework版本似乎并不重要 - 它发生在 4.0 4.5.2 4.6



    我试着用下面的测试框架和他们都给出相同的行为:




    • Microsoft.VisualStudio.QualityTools.UnitTestFramework v14.0.22609.0

    • 的xUnit V2.1.0-β1-build2945 xunit.runner.visualstudio V2.1.0-β1-build1051

    • NUnit的v2.6.4 NUnitTestAdapter V2.0.0



    我觉得有点古怪,谷歌返回的的Microsoft.VisualStudio.Web.ProjectSystem(带引号)零的结果。



    我得到的 MSDN 但这些条款似乎都无关。所以我找不到它的任何文件,可能是由于装配和DLL名称之间有差异。



    问题1 :有谁知道(在哪里可以找到有关信息)本次大会做什么,在它从何而来,为什么它的出现的是为发现单元测试的罪魁祸首?






    现在,它可能(也可能不会)有一些与我试图建立的ASP.NET和的EntityFramework堆栈昨天。我克隆了宇宙库(其中包括完整的堆栈),以我的项目文件夹,然后跑了 build.cmd ,按照说明书记载的自述。除了登录一把没有错误提示为私有仓库,这是我手动取消。



    不过,我无法打开任何ASPNET解决方案之后。我不断收到此错误:



    中导入的项目C:\Program文件(x86)\MSBuild\Microsoft\VisualStudio\\ \\v14.0\DNX\Microsoft.DNX.Props没有被发现。确认在<路径;进口>声明是正确的,并且该文件存在于磁盘上。



    谷歌搜索Microsoft.DNX.Props(带引号)给我一个结果,指着GitHub上的一个问题:请提供VS用户预DNX饲料,直到CPT7发布#377



    这似乎是造成很多重命名,微软最近做的一个已知的问题。我决定离开,就目前而言,等待CTP 7



    问题2 :是否有可能将ASPNET宇宙生成脚本引发的问题?用我的单元测试






    我发现GitHub上(的xUnit)这似乎是相似的问题:的Cannot GET测试发现#295 ,从球队的xUnit此评论:



    <块引用>

    注意的Visual Studio 2015年CTP 5已报道被许多人破
    相一般(不只是xUnit.net)单元测试,所以
    别不要指望,要工作。



    另外,请确保您已经清理了Visual Studio的亚军
    缓存。如果被破坏,直到它删除Visual Studio将永久胡作非为
    。要清除高速缓存,关闭
    的Visual Studio的所有实例,然后删除该文件夹
    %TEMP%\VisualStudioTestExplorerExtensions(说实话,这大概
    不会伤害删除%TEMP一切%可以被删除)。




    虽然我有CTP 6而不是5,我想他们的建议,删除文件夹%TEMP %\VisualStudioTestExplorerExtensions。遗憾的是没有解决的问题。



    此外,我们注意到(偶然)的ReSharper的实际的能发现一些测试。它仅适用于在VS和NUnit测试,不适合的xUnit。我不喜欢使用ReSharper的测试虽然。该Visual Studio的测试资源管理器有什么,我需要和(至少对我来说)是很多更直观



    问3 :为什么视觉工作室是无法发现任何测试,但ReSharper的是什么?






    必须有某种临时或我需要清除缓存文件夹中,但我知道的Visual Studio有很多的他们,而不是所有的人都可以在没有不必要的副作用被删除。



    由于对我得到错误的信息/搜索结果的稀缺性,我位在什么尝试或搜索的损失。


    解决方案

    我所有的单元测试被发现,并成功地重新运行。



    我计算过,清除所有缓存和临时文件夹是不太可能导致这比不能够运行任何测试更有害的问题。所以我被清除,即使是远程看起来像一个Visual Studio相关的临时或缓存文件夹中的一切。



    由于我没有足够的时间去通过一切一个接一个然后测试在两者之间,我遗憾的是不知道哪一个实际导致的问题。






    的解决方案



    我无法找到一个工具,它已经这样做可靠,可能是由于所有的机器和特定版本的路径,使得它很难做到这一点。不过,如果任何人有一个更有效的方法来查找和清除/删除所有临时/缓存文件夹VS用途,我很想听到。你永远不知道什么时候VS决定再次行动起来。



    这些都是我所采取的步骤:




    1. 已退出的Visual Studio与我的Microsoft帐户

    2. 关闭Visual Studio中

    3. 用于CCleaner的清除系统和浏览器温度文件/文件夹

    4. 手动清除/删除以下文件/文件夹:

    $ \Projects\ ...
    (这是我所有的项目居住的地方)

    $ b:在 D b
    $ b

    文件夹
    $ b


    • 所有 OBJ 文件夹(简单搜索)

    • 包的内容我在

    工作方案的文件夹

    ... \AppData\Local\ ...


    $ b文件夹$ b

    • 组装

    • bower\cache

    • kpm\cache

    • 微软\ApplicationInsights

    • Microsoft\UnitTest

    • Microsoft\VisualStudio\14.0\1033\SpecificFolderCache.xml

    • Microsoft\VisualStudio\ 14.0\1033\ProjectTemplateMRU.xml

    • Microsoft\VisualStudio\14.0\ComponentModelCache

    • Microsoft\VisualStudio\14.0\Designer\ShadowCache

    • Microsoft\VisualStudio\14.0\ImageLibrary\cache

    • Microsoft\VisualStudio Services\6.0\\ \\Cache

    • Microsoft\VSCommon\VSAccountManagement\A​​dalCache.cache

    • Microsoft\WebsiteCache

    • NuGet\Cache

    • 温度



    文件夹在 ... \AppData\Roaming\ ...




    • AxTools\VS10x (编码映射扩展)

    • bower\cache

    • NPM-缓存


    EDIT 2016-05-04:

    Since we are now long past the VS2015 beta, the specific issue I had back then is probably not relevant anymore. But it seems like this question is still getting quite a few hits a year after I posted it, so I will share some of the lessons learned since then in the hopes that it helps some people with similar issues. Problems with VS extensions and upgrades come in all sorts of flavors, after all.

    1. The VS MEF Component Cache, located at %localappdata%\Microsoft\VisualStudio\14.0\ComponentModelCache can be a frequent source of problems with extensions.

    Simply close VS and clear the folder. The cache will be automatically reconstructed when you start VS again. There's an extension which allows you to do this from the menu and this is typically one of the first things I try nowadays when I encounter any sort of issues in VS (and it helps quite often): https://visualstudiogallery.msdn.microsoft.com/22b94661-70c7-4a93-9ca3-8b6dd45f47cd

    Deleting the bin and obj folders of your solution at the same time may help to rule out any inconsistencies in your build artifacts caused by a corrupted MEF component cache.

    1. Update VS and your extensions.

    As simple and obvious as it may seem, updates to Visual Studio and/or extensions might be one of the most frequently overlooked solutions to common problems. Double check Tools -> Extensions and Updates -> Updated -> Product Updates and Visual Studio Gallery to see if you have missed anything, and install any updates before you proceed with potentially wasting a lot of time.

    1. Check for problems with your .NET framework installation

    Microsoft has released a neat little tool for this and it has helped me solve an issue or two that occured after updating/installing different versions of the .NET framework in the wrong way: https://www.microsoft.com/en-us/download/details.aspx?id=30135

    1. Check for issues with Windows Update, PATH and/or the registry

    This is especially true for machines that have not been reinstalled for a long time and been through some of the earlier builds of Windows 10 and DNX/DNVM. They may be the cause of a myriad of problems such as leaving invalid references to frameworks in your registry and/or PATH after product renames, as was the case with .NET 4.5.3 to .NET 4.6 and KRE to DNX.

    In some cases a fresh install may just be the most time efficient way to solve most/all of these types of problems in one go. I for one reinstalled everything when VS2015 went out of BETA, to get rid of all the clutter from the frequent updates and changes.

    While slightly out of scope of the question, in some cases the following sequence of commands may help to fix (or at least identify) common problems in Windows in general and consequently also in Visual Studio:

    • dism /online /cleanup-image /restorehealth (checks and, if necessary, fixes your Windows component store)

    • sfc /scannow (uses checksums to look for corruptions in core Windows dlls and registry keys)

    They may not always be able to fix the problems they detect. That can be a signal of an underlying problem with the OS that might make it impossible to fix the problem with VS, if not tackled first.


    Original question:

    Since yesterday, my Visual Studio Test Explorer won't discover tests for any of my projects. It does not show the green loading bar after building, either.

    When I go to the Visual Studio Test Explorer and click "Run All", or when I right-click any test method and select "Run Tests", I get the following in my output window:

    Could not load file or assembly 'Microsoft.VisualStudio.Web.ProjectSystem, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

    I am running Visual Studio 2015 CTP 6 on Windows 10 Pro Technical Preview, build 10041. The .NET Framework version does not seem to matter - it happens on 4.0, 4.5.2 and 4.6.

    I tried with the following testing frameworks and all of them give the same behavior:

    • Microsoft.VisualStudio.QualityTools.UnitTestFramework v14.0.22609.0
    • xunit v2.1.0-beta1-build2945 with xunit.runner.visualstudio v2.1.0-beta1-build1051
    • NUnit v2.6.4 with NUnitTestAdapter v2.0.0

    I find it rather curious that Google returns zero results on "Microsoft.VisualStudio.Web.ProjectSystem" (with the quotes).

    I get a few hits on MSDN but those articles all seem to be unrelated. Therefore I can't find any documentation on it, probably due to a discrepancy between the assembly and DLL name.

    Question 1: Does anyone know (where to find information about) what this assembly does, where it's supposed to come from, and why it appears to be the culprit for discovering unit tests?


    Now, it may (and probably does) have something to do with my attempt to build the ASP.NET and EntityFramework stack yesterday. I cloned the Universe repository (which includes the full stack) to my projects folder and ran build.cmd, as instructed by the readme. No errors besides a handful of login prompts for private repositories, which I manually canceled.

    However, I couldn't open any of the AspNet solutions afterwards. I kept getting this error:

    The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

    Googling for "Microsoft.DNX.Props" (with the quotes) gave me one result, pointing to an issue on GitHub: Please provide pre-DNX feed for VS users until CPT7 is released #377

    It appears to be a known issue caused by a lot of renaming that Microsoft did recently. I decided to leave that for now and wait for CTP 7.

    Question 2: Is it possible that the AspNet Universe build script caused the problem with my unit tests?


    I found an issue on GitHub (xunit) that appeared to be similar: Cannot get tests discovered #295, with this comment from the xunit team:

    Be aware that Visual Studio 2015 CTP 5 has been reported to be broken by many people with unit testing in general (not just xUnit.net), so don't expect that to work.

    Also, please make sure you've cleaned out Visual Studio's runner cache. If it gets corrupted, Visual Studio will permanently misbehave until it's deleted. To clear the cache, shut down all instances of Visual Studio, then delete the folder %TEMP%\VisualStudioTestExplorerExtensions (honestly, it probably wouldn't hurt to delete everything in %TEMP% that can be deleted).

    Although I have CTP 6 instead of 5, I tried their suggestion to delete the folder "%TEMP%\VisualStudioTestExplorerExtensions". Unfortunately that did not fix the problem.

    Furthermore, I noticed (by chance) that ReSharper actually is able to discover some tests. It only works for the VS and NUnit tests, not for xunit. I prefer not to use ReSharper for testing though. The Visual Studio Test Explorer has what I need and (to me at least) is a lot more intuitive.

    Question 3: How come Visual Studio is not able to discover any tests, but ReSharper is?


    There has to be some sort of temp or cache folder I need to clear, but I know Visual Studio has many of them and not all of them can be deleted without unwanted side-effects.

    Due to the scarcity of information / search results on the errors I'm getting, I'm a bit at a loss on what to try or search for.

    解决方案

    All my unit tests are being discovered and run succesfully again.

    I figured that clearing all cache and temp folder would be unlikely to cause problems which are more harmful than not being able to run any tests. So I cleared everything that even remotely looked like a Visual Studio-related temp or cache folder.

    Since I did not have the time to go through everything one-by-one and then test in-between, I unfortunately don't know which one actually caused the problem.


    The "solution"

    I couldn't find a tool which already does this reliably, probably due to all the machine and version-specific paths that make it difficult to do so. Still, if anyone has a more efficient way to locate and clear/delete all temp/cache folders VS uses, I'd love to hear about it. You never know when VS decides to act up again.

    These are all the steps I've taken:

    1. Signed out of Visual Studio with my Microsoft account
    2. Closed Visual Studio
    3. Used CCleaner to clear system and browser temp files/folders
    4. Manually cleared/deleted the following files/folders:

    Folders under D:\Projects\... (this is where all my projects live)

    • All bin and obj folders (simple search)
    • The contents of the packages folders of the solutions I am working on

    Folders under ...\AppData\Local\...

    • assembly
    • bower\cache
    • kpm\cache
    • Microsoft\ApplicationInsights
    • Microsoft\UnitTest
    • Microsoft\VisualStudio\14.0\1033\SpecificFolderCache.xml
    • Microsoft\VisualStudio\14.0\1033\ProjectTemplateMRU.xml
    • Microsoft\VisualStudio\14.0\ComponentModelCache
    • Microsoft\VisualStudio\14.0\Designer\ShadowCache
    • Microsoft\VisualStudio\14.0\ImageLibrary\cache
    • Microsoft\VisualStudio Services\6.0\Cache
    • Microsoft\VSCommon\VSAccountManagement\AdalCache.cache
    • Microsoft\WebsiteCache
    • NuGet\Cache
    • Temp

    Folders under ...\AppData\Roaming\...

    • AxTools\VS10x (CodeMap extension)
    • bower\cache
    • npm-cache

    这篇关于VS2015 CTP6不会发现单元测试(ReSharper的确实发现其中的一些)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆