小编rol*_*i09的帖子

dotnet 测试无法找到具有友好名称“代码覆盖率”的数据收集器

几个月前,当我们的项目仍在 .NET 4.7.2 中时,我们曾经使用该Visual Studio Test任务在 Azure DevOps Server 上运行单元测试。我们使用参数Test files来指定哪些测试程序集需要运行并且Code Coverage在那里工作得很好。

自从我们将项目迁移到 .NET 5.0 以来,我们过去常常dotnet test运行单元测试,但现在Code Coverage不再工作了。

这是一个例子:

D:\test-2-1\_tool\dotnet\dotnet.exe test A.Test.dll B.Test.dll C.Test.dll --logger trx --results-directory D:\test-2-1\_temp --settings D:\test-2-1\5\s\.runsettings
Microsoft (R) Test Execution Command Line Tool Version 16.9.4
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 22 test files matched the specified pattern.
Data collection : Unable to find a datacollector with …
Run Code Online (Sandbox Code Playgroud)

.net xml unit-testing mstest code-coverage

10
推荐指数
1
解决办法
4903
查看次数

无法使用环境变量覆盖appsettings.json设置

我无法appsettings.json使用环境变量覆盖文件的设置。

appsettings.json

{
  "AppSettings": {
    "LocalUpdatesDir": "<some path>",
    "BinaryDeltaCount": 5,
    "BinaryDeltaFilenameTemplate": "<template>",
    "Azure": {
      "User": "user here",
      "Password": "password here"
    }
  },
}
Run Code Online (Sandbox Code Playgroud)

主要:

public static void Main(string[] args)
{
    var webHost = new WebHostBuilder()
        .UseKestrel()
        .UseContentRoot(Directory.GetCurrentDirectory())
        .ConfigureAppConfiguration((hostingContext, config) =>
        {
            var env = hostingContext.HostingEnvironment;
            config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                  .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
            config.AddEnvironmentVariables();
        })
        .UseStartup<Startup>()
        .Build();

    webHost.Run();
}
Run Code Online (Sandbox Code Playgroud)

环境变量:

在此处输入图片说明

更新1:

在这里,我可以看到我所有的提供者都已注册:

在此处输入图片说明

什么是真的很奇怪:在环境变量列表,也有它约80项。我的两个新变量不见了,但是其中有2个环境变量,这些变量是我几个小时前创建并立即删除的。它们来自何处?

更新2:

我重新启动我的电脑,现在我看到我的环境变量在列表中,但它并不能取代在价值appsettings.json

c# .net-core asp.net-core

2
推荐指数
3
解决办法
4572
查看次数

如何在刻录中比较 DetectCondition 中的版本变量(wix)

这是我的 Fragment

<Fragment>
    <Variable Name="Hasp_BundleVersion" Value="7.54.8889.1" />
    <Variable Name="Hasp_IsInstalled" />
    <Variable Name="Hasp_InstalledVersion" />

    <util:RegistrySearch Id="Hasp_IsInstalled"
                         Variable="Hasp_IsInstalled"
                         Root="HKLM"
                         Key="SOFTWARE\Aladdin Knowledge Systems\HASP\Driver\Installer"
                         Value="Version"
                         Result="exists" />

    <util:RegistrySearch Condition="Hasp_IsInstalled"
                         After="Hasp_IsInstalled"
                         Variable="Hasp_InstalledVersion"
                         Root="HKLM"
                         Key="SOFTWARE\Aladdin Knowledge Systems\HASP\Driver\Installer"
                         Value="Version"
                         Result="value" />

    <PackageGroup Id="Hasp">
        <ExePackage Id="Hasp"
                    DisplayName="Hasp"
                    SourceFile="setups\HASPUserSetup.exe"
                    Compressed="yes"
                    DetectCondition="Hasp_IsInstalled AND Hasp_InstalledVersion &gt;= Hasp_BundleVersion"
                    InstallCommand="/s /v/qn"
                    PerMachine="yes"
                    Permanent="yes" />
    </PackageGroup>
</Fragment>
Run Code Online (Sandbox Code Playgroud)

这不起作用,因为它似乎将两个值作为字符串进行比较。这是日志:

[0A74:0A4C][2017-03-29T16:29:02]i000: Initializing string variable 'Hasp_BundleVersion' to value '7.54.8889.1'
[0A74:0A4C][2017-03-29T16:29:02]i000: Setting numeric variable 'Hasp_IsInstalled' to value 1
[0A74:0A4C][2017-03-29T16:29:02]i000: Setting string variable 'Hasp_InstalledVersion' to value '7.54.66980.1'
[0A74:0A4C][2017-03-29T16:29:02]i052: Condition …
Run Code Online (Sandbox Code Playgroud)

wix version burn

1
推荐指数
1
解决办法
3208
查看次数

标签 统计

.net ×1

.net-core ×1

asp.net-core ×1

burn ×1

c# ×1

code-coverage ×1

mstest ×1

unit-testing ×1

version ×1

wix ×1

xml ×1