Unable to build a netstandard2.0 project from a net8.0 unit test
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- csharp
- Lĩnh vực
- build-system, tooling
Hướng nghiên cứu
Bắt đầu từ lệnh gọi MSBuildLocator.RegisterDefaults() của dự án kiểm thử đơn vị và so sánh quá trình phân giải assembly của nó với dotnet build thành công. Tái hiện lỗi GenerateDepsFile cho dự án netstandard2.0 khi nhắm mục tiêu net8.0 hoặc net9.0, sau đó so sánh hành vi khi Microsoft.Extensions.DependencyModel được cài đặt và khi không được cài đặt trong dự án kiểm thử. Hoàn thành có nghĩa là các dự án được build từ kiểm thử đơn vị mà không cần workaround bằng package đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have a unit test which builds several projects targeting net46 and netstandard2.0. net46 ones build successfully, but netstandard2.0 ones fail with the following error:
C:\Program Files\dotnet\sdk\8.0.315\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(284,5): error MSB4018: The "GenerateDepsFile" task failed unexpectedly.
System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.DependencyModel, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (0x80131621)
File name: 'Microsoft.Extensions.DependencyModel, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60'
---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.DependencyModel, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at Microsoft.NET.Build.Tasks.GenerateDepsFile.WriteDepsFile(String depsFilePath)
at Microsoft.NET.Build.Tasks.TaskBase.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\Users\DarkDaskin\Documents\Development\UnityModStudio\UnityModStudio.Build.Tests\bin\Debug\net8.0\Projects\Correct\MultiVersionMultiTarget\MultiVersionMultiTarget.csproj]
The same projects can be built with dotnet build without problems.
I also tried to switch my unit tests to net9.0, but the same error persists (with different assembly version).
I use MSBuildLocator.RegisterDefaults(); to locate an MSBuild instance.
Installing the Microsoft.Extensions.DependencyModel package into the unit test project allows to build everything successfully, but I guess that MSBuildLocator should have loaded this assembly from the SDK directory automatically.
- Ngôn ngữ chính
- C#
- Star
- 262
- Fork
- 91
- Merge trung bình
- 11 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/MSBuildLocator
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
microsoft/MSBuildLocator#390 · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 64/100
microsoft/MSBuildLocator#389 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
microsoft/MSBuildLocator#380 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
microsoft/MSBuildLocator#377 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
microsoft/MSBuildLocator#371 · 1 bình luận ·
Tất cả issue của microsoft/MSBuildLocator
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fluentassertions/fluentassertions#3353 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 78/100
unoplatform/uno#24769 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
AvaloniaUI/Avalonia#22323 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
microsoft/onnxruntime-genai#2633 ·
Maintainer thường phản hồi trong vòng 1 ngày