这是本节的多页打印视图。 点击此处打印.

返回本页常规视图.

durabletask项目

搭建durabletask项目的开发环境

1 - 构建项目

构建 Durable Task 项目

获取源码

cd ~/work/code/durabletask
git clone git@github.com:Azure/durabletask.git

执行 build

遇到问题

在终端执行命令:

$ cd ~/work/code/durabletask/durabletask
dotnet build

报错如下:

dotnet build
MSBuild version 17.9.6+a4ecab324 for .NET
  Determining projects to restore...
C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is 
out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\
sky\work\code\durabletask\durabletask\samples\Correlation.Samples\Correlation.Samples.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is 
out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\
sky\work\code\durabletask\durabletask\test\DurableTask.Stress.Tests\DurableTask.Stress.Tests.csproj::TargetFramework=netcoreapp3.1]
C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.SqlServer.Tests\DurableTask.SqlServer.Tests.csproj : error NU1903: Warning As Error: Package 'System.Data.SqlCli
ent' 4.8.5 has a known high severity vulnerability, https://github.com/advisories/GHSA-98g6-xh36-x2p7 [C:\Users\sky\work\code\durabletask\durabletask\DurableTask.sln]
  Failed to restore C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.SqlServer.Tests\DurableTask.SqlServer.Tests.csproj (in 374 ms).
  23 of 24 projects are up-to-date for restore.

Build FAILED.

C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is 
out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\
sky\work\code\durabletask\durabletask\samples\Correlation.Samples\Correlation.Samples.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is 
out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\
sky\work\code\durabletask\durabletask\test\DurableTask.Stress.Tests\DurableTask.Stress.Tests.csproj::TargetFramework=netcoreapp3.1]
C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.SqlServer.Tests\DurableTask.SqlServer.Tests.csproj : error NU1903: Warning As Error: Package 'System.Data.SqlCli
ent' 4.8.5 has a known high severity vulnerability, https://github.com/advisories/GHSA-98g6-xh36-x2p7 [C:\Users\sky\work\code\durabletask\durabletask\DurableTask.sln]
    2 Warning(s)
    1 Error(s)

vs code 也会因为这个错误而无法解析项目。

解决方案

TBD

临时解决方案

修改 DurableTask.sln 文件,删除 DurableTask.SqlServer.Tests.csproj 这个项目:

Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DurableTask.SqlServer.Tests", "test\DurableTask.SqlServer.Tests\DurableTask.SqlServer.Tests.csproj", "{B835BFA6-D9BB-47C4-8594-38EAE0157BBA}"
EndProject

再删除 313 行:

		{B835BFA6-D9BB-47C4-8594-38EAE0157BBA} = {95C69A06-7F62-4652-A480-207B614C2869}

build 结果

dotnet build
MSBuild version 17.9.6+a4ecab324 for .NET
  Determining projects to restore...
C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is 
out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\
sky\work\code\durabletask\durabletask\samples\Correlation.Samples\Correlation.Samples.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is 
out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\
sky\work\code\durabletask\durabletask\test\DurableTask.Stress.Tests\DurableTask.Stress.Tests.csproj::TargetFramework=netcoreapp3.1]
  All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is 
out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\
sky\work\code\durabletask\durabletask\test\DurableTask.Stress.Tests\DurableTask.Stress.Tests.csproj::TargetFramework=netcoreapp3.1]
C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is 
out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\
sky\work\code\durabletask\durabletask\samples\Correlation.Samples\Correlation.Samples.csproj]
  DurableTask.Core -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Core\bin\Debug\net462\DurableTask.Core.dll
  DurableTask.Core -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Core\bin\Debug\netstandard2.0\DurableTask.Core.dll
  DurableTask.SqlServer -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.SqlServer\bin\Debug\net462\DurableTask.SqlServer.dll
  DurableTask.Emulator -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Emulator\bin\Debug\net462\DurableTask.Emulator.dll
  DurableTask.Test.Orchestrations -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.Test.Orchestrations\bin\Debug\net462\DurableTask.Test.Orchestrations.dll
  The package Microsoft.Azure.DurableTask.Core.2.16.2 is missing a readme. Go to https://aka.ms/nuget/authoring-best-practices/readme to learn why package readmes are important
  .
  Successfully created package 'C:\Users\sky\work\code\durabletask\durabletask\build_output\packages\Microsoft.Azure.DurableTask.Core.2.16.2.nupkg'.
  Successfully created package 'C:\Users\sky\work\code\durabletask\durabletask\build_output\packages\Microsoft.Azure.DurableTask.Core.2.16.2.symbols.nupkg'.
  DurableTask.ServiceBus -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.ServiceBus\bin\Debug\net462\DurableTask.ServiceBus.dll
  DurableTask.ApplicationInsights -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.ApplicationInsights\bin\Debug\netstandard2.0\DurableTask.ApplicationInsights
  .dll
  DurableTask.Test.Orchestrations -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.Test.Orchestrations\bin\Debug\netstandard2.0\DurableTask.Test.Orchestration
  s.dll
  DurableTask.Redis -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Redis\bin\Debug\netstandard2.0\DurableTask.Redis.dll
  DurableTask.SqlServer -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.SqlServer\bin\Debug\netstandard2.0\DurableTask.SqlServer.dll
  DurableTask.AzureServiceFabric -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.AzureServiceFabric\bin\x64\Debug\net462\DurableTask.AzureServiceFabric.dll
  DurableTask.AzureServiceFabric -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.AzureServiceFabric\bin\x64\Debug\net472\DurableTask.AzureServiceFabric.dll
  DurableTask.Emulator -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Emulator\bin\Debug\netstandard2.0\DurableTask.Emulator.dll
  DurableTask.Core.Tests -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.Core.Tests\bin\Debug\net462\DurableTask.Core.Tests.dll
  DurableTask.AzureStorage -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.AzureStorage\bin\Debug\netstandard2.0\DurableTask.AzureStorage.dll
  TestApplication.Common -> C:\Users\sky\work\code\durabletask\durabletask\test\TestFabricApplication\TestApplication.Common\bin\x64\Debug\net472\TestApplication.Common.dll
  DurableTask.Emulator.Tests -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.Emulator.Tests\bin\Debug\net462\DurableTask.Emulator.Tests.dll
  DurableTask.ServiceBus -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.ServiceBus\bin\Debug\netstandard2.0\DurableTask.ServiceBus.dll
  DurableTask.AzureStorage -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.AzureStorage\bin\Debug\net462\DurableTask.AzureStorage.dll
  DurableTask.AzureServiceFabric.Tests -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Tests\bin\x64\Debug\net462\DurableTask.AzureService
  Fabric.Tests.dll
  TestApplication.Common -> C:\Users\sky\work\code\durabletask\durabletask\test\TestFabricApplication\TestApplication.Common\bin\x64\Debug\net462\TestApplication.Common.dll
  The package Microsoft.Azure.DurableTask.Redis.0.1.9-alpha is missing a readme. Go to https://aka.ms/nuget/authoring-best-practices/readme to learn why package readmes are imp
  ortant.
  Successfully created package 'C:\Users\sky\work\code\durabletask\durabletask\build_output\packages\Microsoft.Azure.DurableTask.Redis.0.1.9-alpha.nupkg'.
  DurableTask.ServiceBus.Tests -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.ServiceBus.Tests\bin\Debug\net462\DurableTask.ServiceBus.Tests.dll
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277: Found conflicts between different versions of "Newtonsoft.Json" that could
 not be resolved. [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj] 
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277: There was a conflict between "Newtonsoft.Json, Version=7.0.0.0, Culture=ne 
utral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed". [C:\Users\sky\work\code\durabletask\durableta 
sk\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:     "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30a 
d4fe6b2a6aeed" was chosen because it was primary and "Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" was not. [C:\Users\sky\work\code\dura 
bletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:     References which depend on "Newtonsoft.Json, Version=7.0.0.0, Culture= 
neutral, PublicKeyToken=30ad4fe6b2a6aeed" [C:\Users\sky\.nuget\packages\newtonsoft.json\7.0.1\lib\net45\Newtonsoft.Json.dll]. [C:\Users\sky\work\code\durabletask\durabletask\te 
st\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:         C:\Users\sky\.nuget\packages\newtonsoft.json\7.0.1\lib\net45\Newto 
nsoft.Json.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]    
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:           Project file item includes which caused reference "C:\Users\sky\ 
.nuget\packages\newtonsoft.json\7.0.1\lib\net45\Newtonsoft.Json.dll". [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\Dura 
bleTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\.nuget\packages\newtonsoft.json\7.0.1\lib\net45\N 
ewtonsoft.Json.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj 
]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:     References which depend on or have been unified to "Newtonsoft.Json, V 
ersion=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" []. [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\Dur 
ableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:         C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Cor 
e\bin\Debug\net462\DurableTask.Core.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Int 
egration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:           Project file item includes which caused reference "C:\Users\sky\ 
work\code\durabletask\durabletask\src\DurableTask.Core\bin\Debug\net462\DurableTask.Core.dll". [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabr 
ic.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask 
.Core\bin\Debug\net462\DurableTask.Core.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric 
.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\test\DurableTas 
k.Test.Orchestrations\bin\Debug\net462\DurableTask.Test.Orchestrations.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests 
\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask 
.AzureServiceFabric\bin\x64\Debug\net462\DurableTask.AzureServiceFabric.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Test 
s\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\test\TestFabric 
Application\TestApplication.Common\bin\x64\Debug\net462\TestApplication.Common.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integrati 
on.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:         C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Azu 
reServiceFabric\bin\x64\Debug\net462\DurableTask.AzureServiceFabric.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\Du 
rableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:           Project file item includes which caused reference "C:\Users\sky\ 
work\code\durabletask\durabletask\src\DurableTask.AzureServiceFabric\bin\x64\Debug\net462\DurableTask.AzureServiceFabric.dll". [C:\Users\sky\work\code\durabletask\durabletask\t 
est\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask 
.AzureServiceFabric\bin\x64\Debug\net462\DurableTask.AzureServiceFabric.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Test 
s\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:         C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.client\5.2.6\ 
lib\net45\System.Net.Http.Formatting.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.In 
tegration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:           Project file item includes which caused reference "C:\Users\sky\ 
.nuget\packages\microsoft.aspnet.webapi.client\5.2.6\lib\net45\System.Net.Http.Formatting.dll". [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFab 
ric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.client\5. 
2.6\lib\net45\System.Net.Http.Formatting.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabri 
c.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask 
.AzureServiceFabric\bin\x64\Debug\net462\DurableTask.AzureServiceFabric.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Test 
s\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.core\5.2. 
6\lib\net45\System.Web.Http.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration 
.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.owin\5.2. 
6\lib\net45\System.Web.Http.Owin.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integr 
ation.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:         C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.core\5.2.6\li 
b\net45\System.Web.Http.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tes 
ts.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:           Project file item includes which caused reference "C:\Users\sky\ 
.nuget\packages\microsoft.aspnet.webapi.core\5.2.6\lib\net45\System.Web.Http.dll". [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integrati 
on.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.core\5.2. 
6\lib\net45\System.Web.Http.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration 
.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask 
.AzureServiceFabric\bin\x64\Debug\net462\DurableTask.AzureServiceFabric.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Test 
s\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.owin\5.2. 
6\lib\net45\System.Web.Http.Owin.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integr 
ation.Tests.csproj]
  TestApplication.StatefulService -> C:\Users\sky\work\code\durabletask\durabletask\test\TestFabricApplication\TestApplication.StatefulService\bin\Debug\net472\TestApplication.
  StatefulService.exe
  DurableTask.Emulator.Tests -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.Emulator.Tests\bin\Debug\netcoreapp3.1\DurableTask.Emulator.Tests.dll
  Correlation.Samples -> C:\Users\sky\work\code\durabletask\durabletask\samples\Correlation.Samples\bin\Debug\netcoreapp3.1\Correlation.Samples.dll
  The package Microsoft.Azure.DurableTask.AzureServiceFabric.2.3.11 is missing a readme. Go to https://aka.ms/nuget/authoring-best-practices/readme to learn why package readmes
   are important.
  Successfully created package 'C:\Users\sky\work\code\durabletask\durabletask\build_output\packages\Microsoft.Azure.DurableTask.AzureServiceFabric.2.3.11.nupkg'.
  DurableTask.Redis.Tests -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.Redis.Tests\bin\Debug\netcoreapp3.1\DurableTask.Redis.Tests.dll
  Successfully created package 'C:\Users\sky\work\code\durabletask\durabletask\build_output\packages\Microsoft.Azure.DurableTask.AzureServiceFabric.2.3.11.symbols.nupkg'.
  DurableTask.AzureServiceFabric.Integration.Tests -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\bin\x64\Debug\net462\
  DurableTask.AzureServiceFabric.Integration.Tests.dll
C:\Users\sky\work\code\durabletask\durabletask\samples\DistributedTraceSample\OpenTelemetry\Program.cs(100,48): warning CS1998: This async method lacks 'await' operators and wi
ll run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [C:\Users\sky\w
ork\code\durabletask\durabletask\samples\DistributedTraceSample\OpenTelemetry\OpenTelemetrySample.csproj]
  DurableTask.ServiceBus.Tests -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.ServiceBus.Tests\bin\Debug\netcoreapp3.1\DurableTask.ServiceBus.Tests.dll
  OpenTelemetrySample -> C:\Users\sky\work\code\durabletask\durabletask\samples\DistributedTraceSample\OpenTelemetry\bin\Debug\net6.0\OpenTelemetrySample.dll
  ApplicationInsightsSample -> C:\Users\sky\work\code\durabletask\durabletask\samples\DistributedTraceSample\ApplicationInsights\bin\Debug\net6.0\ApplicationInsightsSample.dll
  DurableTask.Stress.Tests -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.Stress.Tests\bin\Debug\netcoreapp3.1\DurableTask.Stress.Tests.dll
  DurableTask.Core.Tests -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.Core.Tests\bin\Debug\netcoreapp3.1\DurableTask.Core.Tests.dll
  DurableTask.Stress.Tests -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.Stress.Tests\bin\Debug\net462\DurableTask.Stress.Tests.exe
  DurableTask.Samples -> C:\Users\sky\work\code\durabletask\durabletask\samples\DurableTask.Samples\bin\Debug\net462\DurableTask.Samples.exe
  The package Microsoft.Azure.DurableTask.AzureStorage.1.17.1 is missing a readme. Go to https://aka.ms/nuget/authoring-best-practices/readme to learn why package readmes are i
  mportant.
  Successfully created package 'C:\Users\sky\work\code\durabletask\durabletask\build_output\packages\Microsoft.Azure.DurableTask.AzureStorage.1.17.1.nupkg'.
  DurableTask.AzureStorage.Tests -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureStorage.Tests\bin\Debug\netcoreapp3.1\DurableTask.AzureStorage.Tests.dl
  l
  DurableTask.AzureStorage.Tests -> C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureStorage.Tests\bin\Debug\net462\DurableTask.AzureStorage.Tests.dll

Build succeeded.

C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is  
out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\ 
sky\work\code\durabletask\durabletask\samples\Correlation.Samples\Correlation.Samples.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is  
out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\ 
sky\work\code\durabletask\durabletask\test\DurableTask.Stress.Tests\DurableTask.Stress.Tests.csproj::TargetFramework=netcoreapp3.1]
C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is  
out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\ 
sky\work\code\durabletask\durabletask\test\DurableTask.Stress.Tests\DurableTask.Stress.Tests.csproj::TargetFramework=netcoreapp3.1]
C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is  
out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\ 
sky\work\code\durabletask\durabletask\samples\Correlation.Samples\Correlation.Samples.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277: Found conflicts between different versions of "Newtonsoft.Json" that could 
 not be resolved. [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj] 
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277: There was a conflict between "Newtonsoft.Json, Version=7.0.0.0, Culture=ne 
utral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed". [C:\Users\sky\work\code\durabletask\durableta 
sk\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:     "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30a 
d4fe6b2a6aeed" was chosen because it was primary and "Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" was not. [C:\Users\sky\work\code\dura 
bletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:     References which depend on "Newtonsoft.Json, Version=7.0.0.0, Culture= 
neutral, PublicKeyToken=30ad4fe6b2a6aeed" [C:\Users\sky\.nuget\packages\newtonsoft.json\7.0.1\lib\net45\Newtonsoft.Json.dll]. [C:\Users\sky\work\code\durabletask\durabletask\te 
st\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:         C:\Users\sky\.nuget\packages\newtonsoft.json\7.0.1\lib\net45\Newto 
nsoft.Json.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]    
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:           Project file item includes which caused reference "C:\Users\sky\ 
.nuget\packages\newtonsoft.json\7.0.1\lib\net45\Newtonsoft.Json.dll". [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\Dura 
bleTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\.nuget\packages\newtonsoft.json\7.0.1\lib\net45\N 
ewtonsoft.Json.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj 
]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:     References which depend on or have been unified to "Newtonsoft.Json, V 
ersion=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" []. [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\Dur 
ableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:         C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Cor 
e\bin\Debug\net462\DurableTask.Core.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Int 
egration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:           Project file item includes which caused reference "C:\Users\sky\ 
work\code\durabletask\durabletask\src\DurableTask.Core\bin\Debug\net462\DurableTask.Core.dll". [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabr 
ic.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask 
.Core\bin\Debug\net462\DurableTask.Core.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric 
.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\test\DurableTas 
k.Test.Orchestrations\bin\Debug\net462\DurableTask.Test.Orchestrations.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests 
\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask 
.AzureServiceFabric\bin\x64\Debug\net462\DurableTask.AzureServiceFabric.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Test 
s\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\test\TestFabric 
Application\TestApplication.Common\bin\x64\Debug\net462\TestApplication.Common.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integrati 
on.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:         C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Azu 
reServiceFabric\bin\x64\Debug\net462\DurableTask.AzureServiceFabric.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\Du 
rableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:           Project file item includes which caused reference "C:\Users\sky\ 
work\code\durabletask\durabletask\src\DurableTask.AzureServiceFabric\bin\x64\Debug\net462\DurableTask.AzureServiceFabric.dll". [C:\Users\sky\work\code\durabletask\durabletask\t 
est\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask 
.AzureServiceFabric\bin\x64\Debug\net462\DurableTask.AzureServiceFabric.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Test 
s\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:         C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.client\5.2.6\ 
lib\net45\System.Net.Http.Formatting.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.In 
tegration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:           Project file item includes which caused reference "C:\Users\sky\ 
.nuget\packages\microsoft.aspnet.webapi.client\5.2.6\lib\net45\System.Net.Http.Formatting.dll". [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFab 
ric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.client\5. 
2.6\lib\net45\System.Net.Http.Formatting.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabri
c.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask 
.AzureServiceFabric\bin\x64\Debug\net462\DurableTask.AzureServiceFabric.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Test 
s\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.core\5.2. 
6\lib\net45\System.Web.Http.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration 
.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.owin\5.2. 
6\lib\net45\System.Web.Http.Owin.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integr 
ation.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:         C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.core\5.2.6\li 
b\net45\System.Web.Http.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration.Tes 
ts.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:           Project file item includes which caused reference "C:\Users\sky\ 
.nuget\packages\microsoft.aspnet.webapi.core\5.2.6\lib\net45\System.Web.Http.dll". [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integrati 
on.Tests\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.core\5.2. 
6\lib\net45\System.Web.Http.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integration 
.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask 
.AzureServiceFabric\bin\x64\Debug\net462\DurableTask.AzureServiceFabric.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Test 
s\DurableTask.AzureServiceFabric.Integration.Tests.csproj]
C:\Program Files\dotnet\sdk\8.0.203\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3277:             C:\Users\sky\.nuget\packages\microsoft.aspnet.webapi.owin\5.2. 
6\lib\net45\System.Web.Http.Owin.dll [C:\Users\sky\work\code\durabletask\durabletask\test\DurableTask.AzureServiceFabric.Integration.Tests\DurableTask.AzureServiceFabric.Integr 
ation.Tests.csproj]
C:\Users\sky\work\code\durabletask\durabletask\samples\DistributedTraceSample\OpenTelemetry\Program.cs(100,48): warning CS1998: This async method lacks 'await' operators and wi 
ll run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [C:\Users\sky\w 
ork\code\durabletask\durabletask\samples\DistributedTraceSample\OpenTelemetry\OpenTelemetrySample.csproj]
    6 Warning(s)
    0 Error(s)

Time Elapsed 00:00:05.24

2 - 运行单元测试

运行 Durable Task 项目的单元测试

2.1 - 运行单元测试的准备工作

运行 Durable Task 单元测试的准备工作

运行单元测试的准备工作

https://github.com/Azure/durabletask#development-notes

To run unit tests, you must specify your Service Bus connection string for the tests to use. You can do this via the ServiceBusConnectionString app.config value in the test project, or by defining a DurableTaskTestServiceBusConnectionString environment variable. The benefit of the environment variable is that no temporary source changes are required.

要运行单元测试,您必须指定 Service Bus 连接字符串供测试使用。您可以通过测试项目中的 ServiceBusConnectionString app.config值,或通过定义 DurableTaskTestServiceBusConnectionString 环境变量来做到这一点。使用环境变量的好处是无需临时更改源代码。

Unit tests also require Azure Storage Emulator, so make sure it’s installed and running.

单元测试还需要 Azure Storage Emulator,因此请确保它已安装并正在运行。

Note: While it’s possible to use in tests a real Azure Storage account it is not recommended to do so because many tests will fail with a 409 Conflict error. This is because tests delete and quickly recreate the same storage tables, and Azure Storage doesn’t do well in these conditions. If you really want to change Azure Storage connection string you can do so via the StorageConnectionString app.config value in the test project, or by defining a DurableTaskTestStorageConnectionString environment variable.

注意:虽然可以在测试中使用真实的 Azure Storage 帐户,但不建议这样做,因为许多测试会因 409 Conflict 错误而失败。这是因为测试会删除并快速重新创建相同的存储表,而 Azure Storage 在这种情况下表现不佳。如果真的要更改 Azure Storage 连接字符串,可以通过测试项目中的 StorageConnectionString app.config 值,或通过定义 DurableTaskTestStorageConnectionString 环境变量来实现。

修改

StorageConnectionString 有在两个地方进行定义,默认值都是空

  • Test\DurableTask.Core.Tests\app.config
  • Test\DurableTask.ServiceBus.Tests\app.config

还是定义环境变量会更合适

export DurableTaskTestStorageConnectionString=""

Azure Storage Emulator

使用文档:使用 Azure 存储模拟器进行开发和测试(已弃用)

下载并安装

https://go.microsoft.com/fwlink/?linkid=717179&clcid=0x409

若要启动 Azure 存储模拟器:

  1. 选择“开始”按钮或按“Windows”键。
  2. 开始键入 Azure Storage Emulator
  3. 从所示应用程序的列表中选择该模拟器。

Azurite

在 Visual Studio Code 中,选择“扩展”图标并搜索“Azurite”。 选择“安装”按钮以安装 Azurite 扩展。

2.2 - 运行单元测试

运行 Durable Task 单元测试

DurableTask.Core.Tests

路径为 Test/DurableTask.Core.Tests,不需要启动模拟器或者设置 service bus 连接,直接运行:

dotnet test Test/DurableTask.Core.Tests/DurableTask.Core.Tests.csproj

输出为:

  Determining projects to restore...
  All projects are up-to-date for restore.
  DurableTask.Core -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Core\bin\Debug\netstandard2.0\DurableTask.Core.dll
  DurableTask.Core -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Core\bin\Debug\net462\DurableTask.Core.dll
  DurableTask.Emulator -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Emulator\bin\Debug\netstandard2.0\DurableTask.Emulator.dll
  DurableTask.Test.Orchestrations -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Test.Orchestrations\bin\Debug\netstandard2.0\DurableTask.Test.Orchestrati
  ons.dll
  DurableTask.Emulator -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Emulator\bin\Debug\net462\DurableTask.Emulator.dll
  DurableTask.Test.Orchestrations -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Test.Orchestrations\bin\Debug\net462\DurableTask.Test.Orchestrations.dll
  DurableTask.Core.Tests -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Core.Tests\bin\Debug\netcoreapp3.1\DurableTask.Core.Tests.dll
  DurableTask.Core.Tests -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Core.Tests\bin\Debug\net462\DurableTask.Core.Tests.dll
Test run for C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Core.Tests\bin\Debug\netcoreapp3.1\DurableTask.Core.Tests.dll (.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 17.9.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:    59, Skipped:     0, Total:    59, Duration: 21 s - DurableTask.Core.Tests.dll (netcoreapp3.1)
Test run for C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Core.Tests\bin\Debug\net462\DurableTask.Core.Tests.dll (.NETFramework,Version=v4.6.2)
Microsoft (R) Test Execution Command Line Tool Version 17.9.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:    59, Skipped:     0, Total:    59, Duration: 21 s - DurableTask.Core.Tests.dll (net462)

DurableTask.Redis.Tests

dotnet test Test/DurableTask.Redis.Tests/DurableTask.Redis.Tests.csproj

报错无法连接 redis 服务器:

dotnet test Test/DurableTask.Redis.Tests/DurableTask.Redis.Tests.csproj
  Determining projects to restore...
  Restored C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Redis.Tests\DurableTask.Redis.Tests.csproj (in 329 ms).
  2 of 3 projects are up-to-date for restore.
  DurableTask.Core -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Core\bin\Debug\netstandard2.0\DurableTask.Core.dll
  DurableTask.Redis -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Redis\bin\Debug\netstandard2.0\DurableTask.Redis.dll
  The package Microsoft.Azure.DurableTask.Redis.0.1.9-alpha is missing a readme. Go to https://aka.ms/nuget/authoring-best-practices/readme to learn why package readmes are i
  mportant.
  Successfully created package 'C:\Users\sky\work\code\durabletask\durabletask\build_output\packages\Microsoft.Azure.DurableTask.Redis.0.1.9-alpha.nupkg'.
  DurableTask.Redis.Tests -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Redis.Tests\bin\Debug\netcoreapp3.1\DurableTask.Redis.Tests.dll
Test run for C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Redis.Tests\bin\Debug\netcoreapp3.1\DurableTask.Redis.Tests.dll (.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 17.9.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:13.73]     DurableTask.Redis.Tests.EndToEndServiceScenarioTests.SimpleFanOutOrchestration [FAIL]
  Failed DurableTask.Redis.Tests.EndToEndServiceScenarioTests.SimpleFanOutOrchestration [13 s]
  Error Message:
   StackExchange.Redis.RedisConnectionException : It was not possible to connect to the redis server(s). UnableToConnect on localhost:6379/Interactive, Initializing, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 2s ago, last-write: 2s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 11s ago, v: 2.0.571.20511
  Stack Trace:
     at StackExchange.Redis.ConnectionMultiplexer.ConnectImplAsync(Object configuration, TextWriter log) in C:\projects\stackexchange-redis\src\StackExchange.Redis\ConnectionMultiplexer.cs:line 825
   at DurableTask.Redis.RedisOrchestrationService.DeleteAsync() in C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Redis\RedisOrchestrationService.cs:line 267  
   at DurableTask.Redis.Tests.EndToEndServiceScenarioTests.SimpleFanOutOrchestration() in C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Redis.Tests\EndToEndServiceScenarioTests.cs:line 148
--- End of stack trace from previous location where exception was thrown ---
[xUnit.net 00:00:21.90]     DurableTask.Redis.Tests.EndToEndServiceScenarioTests.ScheduledStart_NotSupported [FAIL]
  Failed DurableTask.Redis.Tests.EndToEndServiceScenarioTests.ScheduledStart_NotSupported [8 s]
  Error Message:
   StackExchange.Redis.RedisConnectionException : It was not possible to connect to the redis server(s). UnableToConnect on localhost:6379/Interactive, Initializing, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 2s ago, last-write: 2s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 19s ago, v: 2.0.571.20511
  Stack Trace:
     at StackExchange.Redis.ConnectionMultiplexer.ConnectImplAsync(Object configuration, TextWriter log) in C:\projects\stackexchange-redis\src\StackExchange.Redis\ConnectionMultiplexer.cs:line 825
   at DurableTask.Redis.RedisOrchestrationService.DeleteAsync() in C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Redis\RedisOrchestrationService.cs:line 267  
   at DurableTask.Redis.Tests.EndToEndServiceScenarioTests.ScheduledStart_NotSupported() in C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Redis.Tests\EndToEndServiceScenarioTests.cs:line 229
--- End of stack trace from previous location where exception was thrown ---
[xUnit.net 00:00:30.14]     DurableTask.Redis.Tests.EndToEndServiceScenarioTests.SimpleFanOutOrchestration_DurabilityTest [FAIL]
  Failed DurableTask.Redis.Tests.EndToEndServiceScenarioTests.SimpleFanOutOrchestration_DurabilityTest [8 s]
  Error Message:
   StackExchange.Redis.RedisConnectionException : It was not possible to connect to the redis server(s). UnableToConnect on localhost:6379/Interactive, Initializing, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 2s ago, last-write: 2s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 27s ago, v: 2.0.571.20511
  Stack Trace:
     at StackExchange.Redis.ConnectionMultiplexer.ConnectImplAsync(Object configuration, TextWriter log) in C:\projects\stackexchange-redis\src\StackExchange.Redis\ConnectionMultiplexer.cs:line 825
   at DurableTask.Redis.RedisOrchestrationService.DeleteAsync() in C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Redis\RedisOrchestrationService.cs:line 267  
   at DurableTask.Redis.Tests.EndToEndServiceScenarioTests.SimpleFanOutOrchestration_DurabilityTest() in C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Redis.Tests\EndToEndServiceScenarioTests.cs:line 202
--- End of stack trace from previous location where exception was thrown ---
[xUnit.net 00:00:34.23]     DurableTask.Redis.Tests.EndToEndServiceScenarioTests.DeleteTaskHub_DeletesAllKeysInRelevantNamespace [FAIL]
  Failed DurableTask.Redis.Tests.EndToEndServiceScenarioTests.DeleteTaskHub_DeletesAllKeysInRelevantNamespace [4 s]
  Error Message:
   StackExchange.Redis.RedisConnectionException : It was not possible to connect to the redis server(s). UnableToConnect on localhost:6379/Interactive, Initializing, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 2s ago, last-write: 2s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 31s ago, v: 2.0.571.20511
  Stack Trace:
     at StackExchange.Redis.ConnectionMultiplexer.ConnectImplAsync(Object configuration, TextWriter log) in C:\projects\stackexchange-redis\src\StackExchange.Redis\ConnectionMultiplexer.cs:line 825
   at DurableTask.Redis.Tests.TestHelpers.GetRedisConnection() in C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Redis.Tests\TestHelpers.cs:line 39
   at DurableTask.Redis.Tests.EndToEndServiceScenarioTests.DeleteTaskHub_DeletesAllKeysInRelevantNamespace() in C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Redis.Tests\EndToEndServiceScenarioTests.cs:line 31
--- End of stack trace from previous location where exception was thrown ---
[xUnit.net 00:00:42.37]     DurableTask.Redis.Tests.EndToEndServiceScenarioTests.SimpleGreetingOrchestration [FAIL]
  Failed DurableTask.Redis.Tests.EndToEndServiceScenarioTests.SimpleGreetingOrchestration [8 s]
  Error Message:
   StackExchange.Redis.RedisConnectionException : It was not possible to connect to the redis server(s). UnableToConnect on localhost:6379/Interactive, Initializing, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 2s ago, last-write: 2s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 39s ago, v: 2.0.571.20511
  Stack Trace:
     at StackExchange.Redis.ConnectionMultiplexer.ConnectImplAsync(Object configuration, TextWriter log) in C:\projects\stackexchange-redis\src\StackExchange.Redis\ConnectionMultiplexer.cs:line 825
   at DurableTask.Redis.RedisOrchestrationService.DeleteAsync() in C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Redis\RedisOrchestrationService.cs:line 267  
   at DurableTask.Redis.Tests.EndToEndServiceScenarioTests.SimpleGreetingOrchestration() in C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Redis.Tests\EndToEndServiceScenarioTests.cs:line 110
--- End of stack trace from previous location where exception was thrown ---

Failed!  - Failed:     5, Passed:     6, Skipped:     0, Total:    11, Duration: 41 s - DurableTask.Redis.Tests.dll (netcoreapp3.1)

DurableTask.Emulator.Tests

不需要启动模拟器或者设置 service bus 连接,直接运行:

dotnet test Test/DurableTask.Emulator.Tests/DurableTask.Emulator.Tests.csproj

输出为:

dotnet test Test/DurableTask.Emulator.Tests/DurableTask.Emulator.Tests.csproj 
  Determining projects to restore...
  Restored C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Test.Orchestrations\DurableTask.Test.Orchestrations.csproj (in 192 ms).
  Restored C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Emulator.Tests\DurableTask.Emulator.Tests.csproj (in 192 ms).
  2 of 4 projects are up-to-date for restore.
  DurableTask.Core -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Core\bin\Debug\netstandard2.0\DurableTask.Core.dll
  DurableTask.Core -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Core\bin\Debug\net462\DurableTask.Core.dll
  DurableTask.Emulator -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Emulator\bin\Debug\net462\DurableTask.Emulator.dll
  DurableTask.Test.Orchestrations -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Test.Orchestrations\bin\Debug\net462\DurableTask.Test.Orchestrations.dll
  DurableTask.Emulator -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Emulator\bin\Debug\netstandard2.0\DurableTask.Emulator.dll
  DurableTask.Emulator.Tests -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Emulator.Tests\bin\Debug\net462\DurableTask.Emulator.Tests.dll
  DurableTask.Test.Orchestrations -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Test.Orchestrations\bin\Debug\netstandard2.0\DurableTask.Test.Orchestrati
  ons.dll
  DurableTask.Emulator.Tests -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Emulator.Tests\bin\Debug\netcoreapp3.1\DurableTask.Emulator.Tests.dll
Test run for C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Emulator.Tests\bin\Debug\net462\DurableTask.Emulator.Tests.dll (.NETFramework,Version=v4.6.2)
Microsoft (R) Test Execution Command Line Tool Version 17.9.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:     5, Skipped:     0, Total:     5, Duration: 34 s - DurableTask.Emulator.Tests.dll (net462)
Test run for C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Emulator.Tests\bin\Debug\netcoreapp3.1\DurableTask.Emulator.Tests.dll (.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 17.9.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:     5, Skipped:     0, Total:     5, Duration: 32 s - DurableTask.Emulator.Tests.dll (netcoreapp3.1)

DurableTask.Samples.Tests

dotnet test Test/DurableTask.Samples.Tests/DurableTask.Samples.Tests.csproj 
  Determining projects to restore...
C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Samples.Tests\DurableTask.Samples.Tests.csproj : error NU1201: Project DurableTask.Samples is not compatible w
ith net451 (.NETFramework,Version=v4.5.1). Project DurableTask.Samples supports: net462 (.NETFramework,Version=v4.6.2)
  Failed to restore C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Samples.Tests\DurableTask.Samples.Tests.csproj (in 4.15 sec).
  3 of 4 projects are up-to-date for restore.

DurableTask.ServiceBus.Tests

dotnet test Test/DurableTask.ServiceBus.Tests/DurableTask.ServiceBus.Tests.csproj

必须设置 service bus 连接,否则报错:

  Failed GenerationSubNoCompressionTest [< 1 ms]
  Error Message:
   Initialization method DurableTask.ServiceBus.Tests.FunctionalTests.TestInitialize threw exception. System.TypeInitializationException: The type initializer for 'DurableTask.ServiceBus.Tests.TestHelpers' threw an exception. ---> System.ArgumentException: A ServiceBus connection string must be defined in either an environment variable or in configuration..

DurableTask.SqlServer.Tests

dotnet test Test/DurableTask.SqlServer.Tests/DurableTask.SqlServer.Tests.csproj
dotnet test Test/DurableTask.SqlServer.Tests/DurableTask.SqlServer.Tests.csproj
  Determining projects to restore...
C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.SqlServer.Tests\DurableTask.SqlServer.Tests.csproj : error NU1903: Warning As Error: Package 'System.Data.SqlC
lient' 4.8.5 has a known high severity vulnerability, https://github.com/advisories/GHSA-98g6-xh36-x2p7
  Failed to restore C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.SqlServer.Tests\DurableTask.SqlServer.Tests.csproj (in 280 ms).
  2 of 3 projects are up-to-date for restore.

DurableTask.Stress.Tests

dotnet test Test/DurableTask.Stress.Tests/DurableTask.Stress.Tests.csproj 

没有测试类:

dotnet test Test/DurableTask.Stress.Tests/DurableTask.Stress.Tests.csproj 
  Determining projects to restore...
C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' i
s out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Us
ers\sky\work\code\durabletask\durabletask\Test\DurableTask.Stress.Tests\DurableTask.Stress.Tests.csproj::TargetFramework=netcoreapp3.1]
  Restored C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Stress.Tests\DurableTask.Stress.Tests.csproj (in 521 ms).
  3 of 4 projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' i
s out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Us 
ers\sky\work\code\durabletask\durabletask\Test\DurableTask.Stress.Tests\DurableTask.Stress.Tests.csproj::TargetFramework=netcoreapp3.1]
  DurableTask.Core -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Core\bin\Debug\netstandard2.0\DurableTask.Core.dll
  DurableTask.Core -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Core\bin\Debug\net462\DurableTask.Core.dll
  DurableTask.Test.Orchestrations -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Test.Orchestrations\bin\Debug\netstandard2.0\DurableTask.Test.Orchestrati
  ons.dll
  DurableTask.AzureStorage -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.AzureStorage\bin\Debug\netstandard2.0\DurableTask.AzureStorage.dll
  DurableTask.Test.Orchestrations -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Test.Orchestrations\bin\Debug\net462\DurableTask.Test.Orchestrations.dll
  DurableTask.AzureStorage -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.AzureStorage\bin\Debug\net462\DurableTask.AzureStorage.dll
  DurableTask.Stress.Tests -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Stress.Tests\bin\Debug\net462\DurableTask.Stress.Tests.exe
  DurableTask.Stress.Tests -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Stress.Tests\bin\Debug\netcoreapp3.1\DurableTask.Stress.Tests.dll

DurableTask.Test.Orchestrations

dotnet test Test/DurableTask.Test.Orchestrations/DurableTask.Test.Orchestrations.csproj 
  Determining projects to restore...
  All projects are up-to-date for restore.
  DurableTask.Core -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Core\bin\Debug\netstandard2.0\DurableTask.Core.dll
  DurableTask.Core -> C:\Users\sky\work\code\durabletask\durabletask\src\DurableTask.Core\bin\Debug\net462\DurableTask.Core.dll
  DurableTask.Test.Orchestrations -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Test.Orchestrations\bin\Debug\netstandard2.0\DurableTask.Test.Orchestrati
  ons.dll
  DurableTask.Test.Orchestrations -> C:\Users\sky\work\code\durabletask\durabletask\Test\DurableTask.Test.Orchestrations\bin\Debug\net462\DurableTask.Test.Orchestrations.dll

3 - 运行示例

运行 Durable Task 项目的示例