-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Migration to .NET 6 RC-2 from .NET 5 #22053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
How does this relate to EF Core? |
EF Core depends on I don't understand the issue well enough. So I'm asking somewhat blindly. I can open the issue in a different repo if you tell me which one sounds better. Thanks |
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. |
Here is a simplified repro solution: Repro22053.zip Scenario 1:
Scenario 2:
I don't really know why this happens. Can anyone explain to me why this happens so that next time I know how to fix it? |
@MartyIX if the dll only shows up when the package reference you mentioned above is not commented out, then I expect it's copied as part of that package's dependencies. Is there any reason you expect it to be copied when the package reference is commented out? |
This sentence seems incorrect to me so let me rephrase it. What happens in Scenario 2 is that in case I have:
then And why it is important to have Anyway, I have modified the repro to demonstrate the issue better here: Repro22053.zip. Please just compile, and run in a terminal
and when you comment out |
I took a look at this. What's going on is that the Microsoft.AspNetCore.Authentication.Negotiate package depends on the ASP.NET shared framework (Microsoft.AspNetCore.App). So when you reference it from the IntegrationTests project, the IntegrationTests project also depends on the shared framework. There are some DLLs, including Microsoft.Extensions.DependencyInjection.Abstractions, that are available both as part of the ASP.NET Shared Framework as well as via NuGet packages. If a project uses the shared framework, then if those DLLs also come in via a NuGet package then they will not be included in the output, as they will be loaded from the shared framework. So Microsoft.Extensions.DependencyInjection.Abstractions.dll isn't getting copied to the output folder of the If you can add the following to <ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup> |
@dsplaisted Thank you! That's very informative explanation. How did you actually find out all this? Did you read some msbuild scripts? I ask because I can debug C# code and given enough time I can find many bugs but msbuild is very hard for me to reason about. Is there any book or recommended resource to read to understand this stuff more in depth? |
Here is the main thing you need to know to debug MSBuild: Create binary logs (with the 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. |
Thanks. I know MSBuild Log Viewer but it was still hard for me to find the difference (I found some differences but it was not easy). It's a great tool though. Anyway, this is extremely valuable answer for me. Thanks for that. |
Hi,
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 thebin\debug\net6.0
in a test project (the test project contains "exes references" (#1675))I have asked around and @rolfbjarne adviced to use:
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 theMicrosoft.Extensions.DependencyInjection.Abstractions.dll
is not copied to the output of my test project?Also I can see in
project.deps.json
(.NET 5):and in .NET 6, I can see
(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 mytestproject.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
The text was updated successfully, but these errors were encountered: