question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migration to .NET 6 RC-2 from .NET 5

See original GitHub issue

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 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:open
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dsplaistedcommented, Oct 22, 2021

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.

1reaction
dsplaistedcommented, Oct 14, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrate from ASP.NET Core 5.0 to 6.0
Learn how to migrate an ASP.NET Core 5.0 project to ASP.NET Core 6.0.
Read more >
Migration from Asp.Net Core 5.0 to 6.0 — Real project
The purpose of this article is to share my personal experience in migrating a real production application from .NET 5 to .NET 6....
Read more >
ASP.NET Core RC2 (Migration Guide) - David Pine
This post will serve as a guide that walks you through the steps as I experienced them from migrating existing ASP.NET Core RC1...
Read more >
Migrating from ASP.NET 5 RC1 to ASP.NET Core 1.0
NET Core, so you must first migrate your application to the new .NET Core project model. See migrating from DNX to .NET Core...
Read more >
Should I move my app from .NET 6 to .NET 8 Preview right ...
Just go to .NET 7. End of support for .NET 7 is only 6 months before .NET 6. Plus, any upgrade starting after...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found