Migration to .NET 6 RC-2 from .NET 5
See original GitHub issueHi,
I have attempted to migrate my C# solution (a set of projects) from .NET 5 to .NET 6 RC2 and I have also upgraded efcore to 6 RC2. However, now it happens that Microsoft.Extensions.DependencyInjection.Abstractions.dll
is not copied to the bin\debug\net6.0
in a test project (the test project contains “exes references” (https://github.com/dotnet/sdk/issues/1675))
I have asked around and @rolfbjarne adviced to use:
dotnet build /bl:msbuild.binlog # + install https://msbuildlog.com/
to compare builds on .NET 5 and .NET 6 to find out differences. I did that and I have found out that GenerateDepsFile
task is in like each C# project mentioned in .NET 5 msbuild but that’s not the case for .NET 6. This seems to be the difference. Is it possible that that’s the reason why the Microsoft.Extensions.DependencyInjection.Abstractions.dll
is not copied to the output of my test project?
Also I can see in project.deps.json
(.NET 5):
"Microsoft.Extensions.DependencyInjection/5.0.2": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "5.0.0"
},
"runtime": {
"lib/net5.0/Microsoft.Extensions.DependencyInjection.dll": {
"assemblyVersion": "5.0.0.1",
"fileVersion": "5.0.821.31504"
}
}
},
and in .NET 6, I can see
"Microsoft.Extensions.DependencyInjection/6.0.0-rc.2.21480.5": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0-rc.2.21480.5",
"System.Runtime.CompilerServices.Unsafe": "6.0.0-rc.2.21480.5"
}
},
(i.e. no “runtime” here)
But still I don’t really know why Microsoft.Extensions.DependencyInjection.Abstractions.dll
is not copied to the output as a runtime library as my knowledge of msbuild is limited 😐
I have also tried to add <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0-rc.2.21480.5" />
to my testproject.csproj
file but it does not force to add the missing .dll file to the output.
I understand that nobody can really tell me what exactly is wrong because they would need a repro project (which I don’t have, the solution is not trivial and I’m not even sure if I can separate out that specific issue). However, maybe you guys can tell me if there was any change that might have the consequences I’m observing. Or possibly an idea how to debug it more or how to work it around.
Thank you!
Regards, Martin
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (4 by maintainers)
Top GitHub Comments
Here is the main thing you need to know to debug MSBuild: Create binary logs (with the
-bl
command line switch), and then use the MSBuild Log Viewer to view them. It will let you see all the property and item values, targets and tasks that run and their inputs and outputs, etc. You can search through everything, and you can double click on a project or a target to bring up the MSBuild source to see what it’s doing.For basic information about how MSBuild works, see the following:
Edit: This specific issue was easier for me to find because I’m quite familiar with how the .NET SDK works and have worked with or written a lot of the code. So I looked at a binlog of the build and searched for the DLL name that was missing, and when I saw that it was being counted as a conflict by the ResolvePackageFileConflicts task that pointed me in the right direction.
I’ve moved this to the sdk repo.
Is it possible for you to share the binlogs for us to investigate? They’ll include lots of information (see https://aka.ms/binlog) including your project files and their imports, but not your C# source files.