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.

Running publish more than once copies the wrong depencencies with .Net Core 3

See original GitHub issue

Since I updated my build server with VS2019 and .Net Core 3, my deployment pipelines are failing. The setup on my build server:

  • .Net core version 3.1.200 installed

  • publish command uses Build Engine version 16.5.0+d4cbfca49 for .NET Core.

After investigating, here’s what I found: My project is a rather simple self hostedAsp.Net core project, targeting net461. If I publish it using publish "myAspNetCoreProject.csproj" -o "myOutputPath" -c release The application will work as expected. If I kill the application, and re-publish with the exact same command, then the application will start and stop immediately, without any trace, even in debug mode. After checking the differences in “myOutputPath” between the two publish operations, I found that the 2nd publish seems to copy older version of some dependencies. Here are the modification that are done:

Changed dependencies version after 1st publish version after 2nd publish
System.AppContext.dll 4.6.25714.01 4.6.23123.0
System.Console.dll 4.6.25714.01 4.6.24705.01
System.Diagnostics.FileVersionInfo.dll 4.6.25714.01 4.6.24705.01
System.Diagnostics.StackTrace.dll 4.6.26011.01 4.6.24705.01
System.IO.Compression.dll 4.6.26011.01 4.6.24705.01
System.IO.FileSystem.dll 4.6.25714.01 4.6.24705.01
System.IO.FileSystem.Primitives.dll 4.6.25714.01 4.6.24705.01
System.Runtime.InteropServices.RuntimeInformation.dll 4.6.26011.01 4.6.24705.01
System.Security.Cryptography.Algorithms.dll 4.6.26011.01 4.6.24705.01
System.Security.Cryptography.Encoding.dll 4.6.25714.01 4.6.24705.01
System.Security.Cryptography.Primitives.dll 4.6.25714.01 4.6.24705.01
System.Security.Cryptography.X509Certificates.dll 4.6.25714.01 4.6.24705.01
System.Threading.Thread.dll 4.6.25714.01 4.6.24705.01
System.Xml.ReaderWriter.dll 4.6.25714.01 4.6.24705.01
System.Xml.XmlDocument.dll 4.6.25714.01 4.6.24705.01
System.Xml.XPath.dll 4.6.25714.01 .6.24705.01
System.Xml.XPath.XDocument.dll 4.6.26011.01 4.6.24705.01
  • If I replace only those dependencies after the 2nd publish by their version produced by the 1st publish, it works.
  • If I force an older version of dotnet core with a global.json containing

"sdk": { "version": "2.1.804", "rollForward": "disable" } it also works.

As a temporary solution, I have introduced a step that clears “myOutputPath” before every publish operation, but that does not solve the root cause.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
wli3commented, Apr 8, 2020

@sfoslund could you look into this issue? It is in similar area as your publish incremental build improvement.

0reactions
sfoslundcommented, Nov 4, 2020

Fixed by #14020

Read more comments on GitHub >

github_iconTop Results From Across the Web

Found multiple publish output files with the same relative ...
Issue: The issue raises after .NET 6 migration. There's a new feature that blocks multiple files from being copied to the same target ......
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 >
NET application publishing overview
Applications you create with .NET can be published in two different modes, and the mode affects how a user runs your app.
Read more >
.NET Core SDK Projects: Controlling Output Folders and ...
Exclude existing dependencies with Copy Local False. In the new .NET SDK projects this is more complicated as there's no simple way to...
Read more >
.NET core vs .NET framework
In this post, we'll explain their key differences and how to make the best use of each. Let's begin with a background on...
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