Skip to content

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

@Abarbz

Description

@Abarbz

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions