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.

net core 3.0 (and higher) publish project with wrong dependencies

See original GitHub issue

net core 3.0 (and higher) publish project with wrong dependencies

I have console project ProblemMainApp. It has dependencies from Helper and Newtonsoft.Json 12.0.2. Helper.csproj depend from Microsoft.Extensions.Configuration.Json 2.0.1. Microsoft.Extensions.Configuration.Json 2.0.1 depend from Newtonsoft.Json 10.0.1. image

I publish project with command: dotnet publish -c Debug -f netcoreapp2.0 --force -r centos.7-x64 -o D:\Publish\test If I have installed netcore 2.* on my comp, that in output folder have Newtonsoft.Json 12.0.2. But if I have installed netcore 3.* on my comp, that in output folder have Newtonsoft.Json 10.0.1 and program not working. I need to add a reference to Newtonsoft.Json 12.0.2 in Helper.csproj, even though it’s not needed.

ProblemMainApp.zip

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:11
  • Comments:49 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Mgamerzcommented, Aug 5, 2020

Been having this issue again, it’s essentially making my application unusable, I publish it, some dependency doesn’t work, publish it again after somehow fixing it, another dependency doesn’t work, app just endlessly crashes for my users. This is getting frustrating.

2reactions
blacksnake-ruscommented, Dec 9, 2021

I’ve just being bitten by the same issue. In my case, I was using the dotnet publish task in Azure DevOps with a path to the solution file .sln. I fixed by using the path to the main .csproj that references directly Newtonsoft.Json 13.0.0.1.

It helps if you can get from the main .csproj to any other .csproj by dependencies. In my case, the dependencies are pulled through a .dll using AutoFac.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Published output looking for wrong dependency
Goal. I have two .NET Core console applications - Application.dll and Updater.dll . I want to publish Updater.
Read more >
dotnet publish command - .NET CLI
dotnet publish - Publishes the application and its dependencies to a folder for deployment to a hosting system.
Read more >
Wrong DLL being used in release : r/dotnet
Or only on Publish? I am seeing an issue where the wrong version of DLLs gets published, but it doesn't affect Debug/Release builds...
Read more >
Dependency Management in Visual Studio: NuGet and Beyond
Learn how to manage NuGet package dependencies for your .NET projects using Visual Studio.
Read more >
Deploying an ASP.NET core application with Elastic Beanstalk
The dotnet publish command generates compiled classes and dependencies that you can bundle with a web.config file to create a site archive. The...
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