.NET 5 が GA しましたね。どんどんインストールしていきましょう。
さて Project Tye はこれまで .NET 5 では動きませんでした。
バージョンでいうと 0.4.0-alpha.20371.1
ですね。
$ tye --version 0.4.0-alpha.20371.1+d7623120d66b85bfeda8ab69eb5ff792df6b7243
.NET 5 の GA のタイミングと合わせたかどうかはわかりませんが、11月5日にバージョン 0.5.0-alpha.20555.1
がリリースされて .NET 5 でも動作するようになりました。
ただし公式には特にアナウンスが出ていないため、何かしら不具合があるかもしれません。そういうときはフィードバックしましょう。
.NET 5 + 0.4.0-alpha.20371.1
まず動作しなかったときのログを貼っときます。
$ tye run -v Debug Loading Application Details... Locating .NET SDK... Found .NET SDK at: C:\Program Files\dotnet\sdk\5.0.100\ Registered .NET SDK.Loading project 'D:\src\yuta\netcore\project-tye\project-tye-sample\backend\backend.csproj'. Drats! 'run' failed: Failed to load project: 'D:\src\yuta\netcore\project-tye\project-tye-sample\backend\backend.csproj'. Microsoft.Build.Exceptions.InvalidProjectFileException: SDK 競合回避モジュールの型 "WorkloadSdkResolver" を読み込めま せんでした。Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. 指定されたファイルが見つかりません。 D:\src\yuta\netcore\project-tye\project-tye-sample\backend\backend.csproj ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. 指定されたファイルが見つかりません。 File name: 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.WorkloadSdkResolver..ctor() --- End of inner exception stack trace --- at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args) at Microsoft.Build.Shared.ProjectFileErrorUtilities.ThrowInvalidProjectFile(BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args) at Microsoft.Build.BackEnd.SdkResolution.SdkResolverLoader.LoadResolvers(String resolverPath, LoggingContext loggingContext, ElementLocation location, List`1 resolvers) at Microsoft.Build.BackEnd.SdkResolution.SdkResolverLoader.LoadResolvers(LoggingContext loggingContext, ElementLocation location) at Microsoft.Build.BackEnd.SdkResolution.SdkResolverService.Initialize(LoggingContext loggingContext, ElementLocation location) at Microsoft.Build.BackEnd.SdkResolution.SdkResolverService.ResolveSdk(Int32 submissionId, SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath, Boolean interactive, Boolean isRunningInVisualStudio) at Microsoft.Build.BackEnd.SdkResolution.CachingSdkResolverService.<>n__0(Int32 submissionId, SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath, Boolean interactive, Boolean isRunningInVisualStudio) at Microsoft.Build.BackEnd.SdkResolution.CachingSdkResolverService.<>c__DisplayClass3_0.<ResolveSdk>b__1() at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy`1.CreateValue() at System.Lazy`1.get_Value() at Microsoft.Build.BackEnd.SdkResolution.CachingSdkResolverService.ResolveSdk(Int32 submissionId, SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath, Boolean interactive, Boolean isRunningInVisualStudio) at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError) at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult) at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) at Microsoft.Build.Evaluation.Evaluator`4.Evaluate() at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive) at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.FromFile(String file, ProjectOptions options) at Microsoft.Tye.ProjectReader.EvaluateProject(OutputContext output, DotnetProjectServiceBuilder project) in /_/src/Microsoft.Tye.Core/ProjectReader.cs:line 166
Tye のアップデート
Tye は .NET Core グローバルツール であるため .NET CLI でアップデートを行います。
$ dotnet tool update -g Microsoft.Tye --version "0.5.0-alpha.20555.1" ツール 'microsoft.tye' がバージョン '0.4.0-alpha.20371.1' からバージョン '0.5.0-alpha.20555.1' に正常に更新されました。 $ tye --version 0.5.0-alpha.20555.1+fae47325b0c8d7dafcdec5d1248191b24b2adc23
.NET 5 で動くようになった
ツールをバージョンアップすればアプリケーションや tye.yaml を変更することなく動作しました。
$ cat tye.yaml # tye application configuration file # read all about it at https://github.com/dotnet/tye # # when you've given us a try, we'd love to know what you think: # https://aka.ms/AA7q20u # name: microservice registry: tsubakimoto services: - name: backend project: backend\backend.csproj - name: frontend project: frontend\frontend.csproj env: - name: YOUR_NAME value: "YUTA in YAML" - name: redis image: redis bindings: - port: 6379 connectionString: "${host}:${port}" - name: redis-cli image: redis args: "redis-cli -h redis MONITOR" $ tye run -v Debug Loading Application Details... Restoring and evaluating projects Resolved metadata for service backend at D:\src\yuta\netcore\project-tye-sample\backend\obj\Debug\netcoreapp3.1\MicrosoftTye.ProjectMetadata.txt Resolved metadata for service frontend at D:\src\yuta\netcore\project-tye-sample\frontend\obj\Debug\netcoreapp3.1\MicrosoftTye.ProjectMetadata.txt Restore and project evaluation took: 4318.6486ms Found application version: 1.0.0 RunCommand=D:\src\yuta\netcore\project-tye-sample\backend\bin\Debug\netcoreapp3.1\backend.exe RunArguments= TargetPath=D:\src\yuta\netcore\project-tye-sample\backend\bin\Debug\netcoreapp3.1\backend.dll PublishDir=bin\Debug\netcoreapp3.1\publish\ AssemblyName=backend IntermediateOutputPath=obj\Debug\netcoreapp3.1\ Found target framework: netcoreapp3.1 Parsed target framework name: netcoreapp Parsed target framework version: 3.1 Found shared frameworks: Microsoft.NETCore.App, Microsoft.AspNetCore.App IsAspNet=True Evaluation Took: 7.4286ms Found application version: 1.0.0 RunCommand=D:\src\yuta\netcore\project-tye-sample\frontend\bin\Debug\netcoreapp3.1\frontend.exe RunArguments= TargetPath=D:\src\yuta\netcore\project-tye-sample\frontend\bin\Debug\netcoreapp3.1\frontend.dll PublishDir=bin\Debug\netcoreapp3.1\publish\ AssemblyName=frontend IntermediateOutputPath=obj\Debug\netcoreapp3.1\ Found target framework: netcoreapp3.1 Parsed target framework name: netcoreapp Parsed target framework version: 3.1 Found shared frameworks: Microsoft.NETCore.App, Microsoft.AspNetCore.App IsAspNet=True Evaluation Took: 4.5876ms Launching Tye Host... [09:23:22 INF] Executing application from D:\src\yuta\netcore\project-tye-sample\tye.yaml [09:23:23 INF] Dashboard running on http://127.0.0.1:8000 [09:23:26 INF] Docker image redis already installed [09:23:26 INF] Creating docker network tye_network_5b44c29a-7 [09:23:26 INF] Running docker command network create --driver bridge tye_network_5b44c29a-7 [09:23:27 INF] Running image redis for redis_2390830d-a [09:23:27 INF] Running image redis for redis-cli_94877efc-3 [09:23:27 INF] Running image mcr.microsoft.com/dotnet/core/sdk:3.1 for backend-proxy_c7967b52-b [09:23:27 INF] Running image mcr.microsoft.com/dotnet/core/sdk:3.1 for frontend-proxy_f67a9f1e-9 [09:23:27 INF] Building projects [09:23:31 INF] Running container redis_2390830d-a with ID e1c1c6eae24b [09:23:31 INF] Running container redis-cli_94877efc-3 with ID 5b5a0450106a [09:23:31 INF] Running docker command network connect tye_network_5b44c29a-7 redis_2390830d-a --alias redis [09:23:31 INF] Running docker command network connect tye_network_5b44c29a-7 redis-cli_94877efc-3 --alias redis-cli [09:23:33 INF] Replica redis_2390830d-a is moving to a ready state [09:23:33 INF] Collecting docker logs for redis_2390830d-a. [09:23:33 INF] Replica redis-cli_94877efc-3 is moving to a ready state [09:23:33 INF] Collecting docker logs for redis-cli_94877efc-3. [09:23:34 INF] Running container backend-proxy_c7967b52-b with ID f436fa86c3e4 [09:23:34 INF] Running docker command network connect tye_network_5b44c29a-7 backend-proxy_c7967b52-b --alias backend [09:23:34 INF] Running container frontend-proxy_f67a9f1e-9 with ID e34e0f29521d [09:23:34 INF] Running docker command network connect tye_network_5b44c29a-7 frontend-proxy_f67a9f1e-9 --alias frontend [09:23:35 INF] Collecting docker logs for frontend-proxy_f67a9f1e-9. [09:23:35 INF] Collecting docker logs for backend-proxy_c7967b52-b. [09:23:37 INF] Launching service backend_937c6cf4-7: D:\src\yuta\netcore\project-tye-sample\backend\bin\Debug\netcoreapp3.1\backend.exe [09:23:37 INF] Launching service frontend_418c4bc0-4: D:\src\yuta\netcore\project-tye-sample\frontend\bin\Debug\netcoreapp3.1\frontend.exe [09:23:37 INF] backend_937c6cf4-7 running on process id 7760 bound to http://localhost:59007, https://localhost:59008 [09:23:37 INF] frontend_418c4bc0-4 running on process id 36020 bound to http://localhost:59009, https://localhost:59010 [09:23:37 INF] Replica backend_937c6cf4-7 is moving to a ready state [09:23:37 INF] Replica frontend_418c4bc0-4 is moving to a ready state [09:23:38 INF] Selected process 7760. [09:23:38 INF] Selected process 36020. [09:23:38 INF] Listening for event pipe events for backend_937c6cf4-7 on process id 7760 [09:23:38 INF] Listening for event pipe events for frontend_418c4bc0-4 on process id 36020