Repository navigation
Closed
Closed
Copy link
Milestone
Description
4>------ 已启动全部重新生成: 项目: Microsoft.Extensions.DependencyInjection.Abstractions (src\Microsoft.Extensions.DependencyInjection.Abstractions), 配置: Debug Any CPU ------
4>Microsoft.Extensions.DependencyInjection.Abstractions -> D:\Git\Github\runtime\artifacts\bin\Microsoft.Extensions.DependencyInjection.Abstractions\Debug\net6.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll
4>Microsoft.Extensions.DependencyInjection.Abstractions -> D:\Git\Github\runtime\artifacts\bin\Microsoft.Extensions.DependencyInjection.Abstractions\Debug\netstandard2.1\Microsoft.Extensions.DependencyInjection.Abstractions.dll
4>Microsoft.Extensions.DependencyInjection.Abstractions -> D:\Git\Github\runtime\artifacts\bin\Microsoft.Extensions.DependencyInjection.Abstractions\Debug\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll
4>C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(172,5): error MSB4018: “GenerateDepsFile”任务意外失败。
4>C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(172,5): error MSB4018: System.NullReferenceException: 未将对象引用设置到对象的实例。
4>C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(172,5): error MSB4018: 在 Microsoft.NET.Build.Tasks.ReferenceInfo.GetVersion(ITaskItem referencePath)
4>C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(172,5): error MSB4018: 在 Microsoft.NET.Build.Tasks.ReferenceInfo.CreateReferenceInfo(ITaskItem referencePath)
4>C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(172,5): error MSB4018: 在 Microsoft.NET.Build.Tasks.ReferenceInfo.CreateReferenceInfos(IEnumerable`1 referencePaths)
4>C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(172,5): error MSB4018: 在 Microsoft.NET.Build.Tasks.GenerateDepsFile.WriteDepsFile(String depsFilePath)
4>C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(172,5): error MSB4018: 在 Microsoft.NET.Build.Tasks.TaskBase.Execute()
4>C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(172,5): error MSB4018: 在 Microsoft.NET.Build.Tasks.TaskWithAssemblyResolveHooks.Execute()
4>C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(172,5): error MSB4018: 在 Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
4>C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(172,5): error MSB4018: 在 Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
4>已完成生成项目“Microsoft.Extensions.DependencyInjection.Abstractions.csproj”的操作 - 失败。
4>Microsoft.Extensions.DependencyInjection.Abstractions -> D:\Git\Github\runtime\artifacts\bin\Microsoft.Extensions.DependencyInjection.Abstractions\Debug\net7.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll
========== 全部重新生成: 成功 3 个,失败 1 个,跳过 0 个 ==========
vs version 17.1.2
@ericstj what should I do
Activity
Linlccc commentedon Mar 24, 2022
I clicked on the error message and jumped to
C:\ProgramFiles\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targetsfile, the following is the line information selected by the cursorericstj commentedon Mar 24, 2022
This looks to me like the same issue as #40159. It shouldn't fail with a NullReference, that's tracked in dotnet/sdk#2716
In those cases we were able to look at the ReferencePaths parameter (using https://msbuildlog.com) passed to GenerateDepsFile and found one reference missing version information from the FusionName metadata. In the cases we saw this happen it was sometimes caused by
Linlccc commentedon Mar 26, 2022
@ericstj I replied to you at dotnet/sdk#2716 (comment), I don't know if you see it, what should I do next
ericstj commentedon Mar 28, 2022
Your binlog is missing a lot of information. For example all the inputs to the failing task. For help on this issue please reply here, the SDK issue is tracking the bug in the task. Let's let this issue track getting you unblocked building the SLN (workaround that bug).
Can you make sure to capture a full binlog? I believe this is a VS setting.
Linlccc commentedon Mar 29, 2022
Thank you very much, my problem is solved now, but I don't know why, I can't build the project in VS, but I try to build in the command line and it is successful, I will upload the log file of this success, if you are interested It is helpful to use it, if not, please ignore it, thank you again here
msbuild.zip
ericstj commentedon Mar 29, 2022
It should build in VS. The fact that it doesn't is still a problem. I believe we can fix that problem with a change the SLN. If you get a chance to capture a full log in VS please capture and attach. If not someone on our side can try a repo and find out what's missing from the SLN.
The SLN is not used for the command-line build.
Linlccc commentedon Mar 30, 2022
After I successfully built the command line, I came back to VS and the build was successful. Now I can't reproduce that error here.
But I found that this problem only occurs under the main branch of dotnet\runtime (I tried this on multiple computers),
Because I tried to get other branches when I couldn't build before and restored it directly in VS and it was successful.
ericstj commentedon Apr 4, 2022
I couldn't reproduce your exact error, but I was able to reproduce something similar with some changes to the project. I added a project reference, built the reference, but not the src project, then tried to build the library (without adding the project to the SLN). This caused the error.
Can you let me know what steps you were following before first opening the project in Visual Studio? Did you first do a
build libsfrom the commandline or not? cc @ViktorHofer12 remaining items
ViktorHofer commentedon Apr 29, 2022
@Linlccc thanks again for sharing your feedback and the steps that you followed. #68668 should fix the underlying issue. Could you please checkout my branch and test the changes on your machine? I would expect that after an initial build of libs, the solution file should now work as expected.
That should allow you to both build and test inside Visual Studio successfully. Thanks
Linlccc commentedon Apr 30, 2022
@ViktorHofer When I build directly in Visual Studio, there are still failures other than the "GenerateDepsFile" task
Then I tried to build with msbuild in the command line with no problems again
After building from the command line, back in Visual Studio and building again, there is no problem, the result is the same as before
This gives me no clue, I don't know why I have no problems building from the command line, or building from the command line and then building with visual studio (without making any changes to the source code files), just Building directly in visual studio will have problems
Linlccc commentedon Apr 30, 2022
@ViktorHofer I have a question, is there any difference between building with msbuild from the command line and building in visual studio
I feel like they should all use msbuild's build, but there is an error that I can't understand, and there is no other place
ViktorHofer commentedon Apr 30, 2022
Yes, Visual Studio uses the netframework flavour of msbuild, vs the CLI which uses the netcoreapp version.
Can you please post the failures that you are still seeing when building inside VS?
Linlccc commentedon Apr 30, 2022
@ViktorHofer Only this log is generated during the process
Uploading Microsoft.Extensions.DependencyInjection.Abstractions_Debug_AnyCPU_Build_2022-05-01T00_12_16.6517938+08_00.binlog.zip…
ViktorHofer commentedon May 1, 2022
I meant either the error window or the output window log. The actual errors that you see inside VS.
Linlccc commentedon May 1, 2022
Same as this
eerhardt commentedon May 1, 2022
Looks to be the same as dotnet/sdk#2716
ViktorHofer commentedon May 2, 2022
Right, @ericstj already linked to that issue earlier: #67091 (comment).
I was hoping that making sure that all dependencies are part of the solution file would solve this issue but apparently it doesn't. I couldn't yet repro that issue so I'm wondering in which way @Linlccc's environment is different than any others.