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.

"dotnet publish" for web app fails to complete when targeting "net46x" in VS 2017 RC

See original GitHub issue

I’m running the latest .NET 1.1 SDK (1.0.0-preview5-004275) and tools, and am receiving an error when trying to run “dotnet publish” on a ASP.NET Core web application. It builds without errors, and if I change “net462” to “net452” it publishes fine. It also published fine when targeting net462 before the migration from the project.json format to the csproj format. I discovered the error when migrating my Service Fabric application from VS 2015 to VS 2017, but soon realized it applied to all Core web apps and am able to reproduce it using the below approach. I have a gist of a sample failing csproj file here as well.

Steps to reproduce

  1. In VS 2017, add a new ASP.NET Core Web Application (either Web API or Web Application is fine)
  2. Edit the associated .csproj file, and change


  1. Remove the <PackageReference Include="Microsoft.NETCore.App" Version="1.0.1" /> entry from the PackageReference section.
  2. Build the project
  3. Run dotnet publish.

Expected behavior

It publishes successfully.

Actual behavior

Receive the following error: C:\Program Files\dotnet\sdk\1.0.0-preview5-004275\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Publish.targets(128,5): error MSB3094: "DestinationFiles" refers to 1 item(s), and "SourceFiles" refers to 2 item(s). They must have the same number of items

Environment data

.NET Command Line Tools (1.0.0-preview5-004275)

Product Information:
 Version:            1.0.0-preview5-004275
 Commit SHA-1 hash:  f1c16e59d6

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.0.0-preview5-004275

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

elepnercommented, Jan 27, 2017

We’re still experiencing the same issue with the latest VS 2017 RC with failing Copy task “DestinationFiles” refers to 1 item(s), and “SourceFiles” refers to 2 item(s). They must have the same number of items…

stevenshortcommented, Jun 7, 2017

Ah, I’ve been looking a few different bugs. Mine is the same behavior but with packaging service fabric - not .net core - sorry

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS2017 15.6 : Publish web application fails
I have a web application (Asp.Net MVC) which builds without errors en which I can publish (local directory) without problems in vs2017 15.5.7....
Read more >
VS2017 RC Web deploy - core
Now, when it works, I can't deploy it! I deploy it to IIS (Windows Server 2012 R2) and I get the error saying....
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 >
A brand new website interface for an even better experience!
"dotnet publish" for web app fails to complete when targeting "net46x" in VS 2017 RC.
Read more >
Why is Bamboo dotnet publish running older 2.1 ver...
I have a .net core 2.2 web app that has been building successfully in Bamboo for several months. Recently someone built a new...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found