【问题标题】:Running the benchmarks - new to .NET运行基准测试 - .NET 新手
【发布时间】:2021-12-04 09:18:00
【问题描述】:

我正在尝试在https://github.com/jstedfast/MimeKit 中运行基准测试并遇到版本问题。我在 Mac 上,使用 vscode 并安装了带有自制软件的 .NET SDK。它给了我 dotnet-sdk-5.0.401-osx-x64.pkg。当我尝试在 Benchmarks 目录中运行 dotnet build 时,我得到了

% dotnet build
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  MimeKit -> /Users/chris.topinka/smarsh-vscode-dev/MimeKit/MimeKit/bin/Debug/net50/MimeKit.dll
/usr/local/share/dotnet/sdk/5.0.401/Microsoft.Common.CurrentVersion.targets(1217,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.5 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [/Users/chris.topinka/smarsh-vscode-dev/MimeKit/Mono.Data.Sqlite/Mono.Data.Sqlite.csproj]

Build FAILED.

/usr/local/share/dotnet/sdk/5.0.401/Microsoft.Common.CurrentVersion.targets(1217,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.5 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [/Users/chris.topinka/smarsh-vscode-dev/MimeKit/Mono.Data.Sqlite/Mono.Data.Sqlite.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.84

有没有办法安装正确的版本或将项目重新定位到 5?谢谢。

【问题讨论】:

标签: .net macos visual-studio-code benchmarking mimekit


【解决方案1】:

问题在于构建多目标的 MimeKit 项目本身(包括 .NET v4.5)。

显然您没有为 .NETFramework v4.5 安装必要的 SDK,因此无法构建。

您可以通过编辑 MimeKit.csproj 并编辑 <TargetFrameworks> 值以删除 net45 来禁用此功能。

也就是说,当前值为:

<TargetFrameworks>netstandard2.0;netstandard2.1;net45;net46;net47;net48;net50</TargetFrameworks>

你需要编辑的是:

<TargetFrameworks>netstandard2.0;netstandard2.1;net46;net47;net48;net50</TargetFrameworks>

更新:

我在 gitter 上看到了你的问题。

由于您尝试对 MimeKit 的解析器进行基准测试并将其与 Mime4j 进行比较,因此使用 https://github.com/jstedfast/MimeParserBenchmark 可能会更容易(同样的想法,这只是从 MimeKit 代码库中分离出来的)。

这将使用 MimeKit nuget 包,这将更容易并允许您通过编辑 Benchmark.csproj 文件并将 &lt;TargetFramework&gt; XML 节点更改为 @ 来定位 .net5 或 .net48 或您想要的任何其他 .net 框架版本987654327@ 或其他。

它还比较了 mime4net 包,它是 mime4j 的一个端口 现有基准测量解析消息(或 mbox)100 次或 1000 次所需的时间。

【讨论】:

    猜你喜欢
    • 2010-11-12
    • 2022-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    • 2011-09-18
    • 2017-07-07
    相关资源
    最近更新 更多