惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
博客园 - 【当耐特】
人人都是产品经理
人人都是产品经理
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
Blog — PlanetScale
Blog — PlanetScale
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
Jina AI
Jina AI
小众软件
小众软件
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
大猫的无限游戏
大猫的无限游戏
博客园 - 聂微东
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
I
InfoQ
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Martin Fowler
Martin Fowler
P
Proofpoint News Feed
MyScale Blog
MyScale Blog

博客园 - 一叶浮萍

Microsoft.AspNetCore.Http.Abstractions 2.20 is deprecated 使用office365 world2016发布编辑备份你的博客 使用office365 world2016发布编辑备份你的博客 You are not late! You are not early! 在同一个服务器(同一个IP)为不同域名绑定的免费SSL证书 Vue.js Is Good, but Is It Better Than Angular or React? It was not possible to find any compatible framework version VS增加插件 Supercharger破解教程 Git使用ssh key Disconnected: No supported authentication methods available (server sent: publickey) VS 2013打开.edmx文件时报类型转换异常 Echarts ecomfe 触摸屏 touch 在IE10下无法显示悬浮框 64位系统里注册32位软件 System.Data.Dbtype转换为System.Data.SqlDbType Bonobo Git Server (Simple git server for Windows.) 测试备忘 TortoiseGit bonobo gitserver记住帐号密码 TortoiseGit bonobo gitserver记住帐号密码 TITLE: BizTalk Server 2013 Administration Console 应用程序-特定 权限设置并未向在应用程序容器 不可用 SID (不可用)中运行的地址 LocalHost (使用 LRPC) 中的用户
Visual Studio 2022 Net6.0 无法发现testcase, 也无法执行te...
一叶浮萍 · 2023-07-19 · via 博客园 - 一叶浮萍

错误1:

编译正确,运行时 Tests 输出报错,

Failed to load extensions from file 'C:\Users\tangj15\.nuget\packages\xunit.runner.visualstudio\2.5.0\build\net6.0\xunit.runner.visualstudio.dotnetcore.testadapter.dll'. Please use /diag for more information.

错误2:

编译正确,但编译完成时查看Tests输出,提示自动发现test case时错误

Failed to load extensions from file 'C:\Users\tangj15\.nuget\packages\xunit.runner.visualstudio\2.5.0\build\net6.0\xunit.runner.visualstudio.dotnetcore.testadapter.dll'. Please use /diag for more information.

解决办法:

针对错误1,添加如下属性,且设置为true。

    <PropertyGroup>
							
        <CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
											
        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
											
        <GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
											
        <GenerateDocumentationFile>false</GenerateDocumentationFile>
											
        <GenerateDependencyFile>false</GenerateDependencyFile>
											
    </PropertyGroup>
							

针对错误2,添加如下引用。不可缺少(针对xunit)

    <ItemGroup>
							
      <PackageReference Include="coverlet.collector" Version="6.0.0">
																			
        <PrivateAssets>all</PrivateAssets>
											
        <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
											
      </PackageReference>
							
      <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
																			
      <PackageReference Include="Microsoft.TestPlatform" Version="17.6.3" />
																			
      <PackageReference Include="xunit" Version="2.5.0" />
																			
      <PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
																			
        <PrivateAssets>all</PrivateAssets>
											
        <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
											
      </PackageReference>
							
    </ItemGroup>