I get the following message when I try and Publish:
Severity Code Description Project File Line Suppression State
Error "DestinationFiles" refers to 1 item(s), and "SourceFiles" refers to 2 item(s). They must have the same number of items.
I have my project working on my localhost and I am now looking to publish...but I get the above error. I converted my project from VS 2015 and Publishing was working fine. Just to make sure my old Publishing Profile wasn't the issue , I deleted my old working copy of my Profile and set up a new one. I know that VS 2017 was just released a couple of days ago, any help would be great.
Visual Studio 2017 Support for . Among the workloads and project types, you can find support for . NET Framework, . NET Core, Mono, and . NET Native for Universal Windows Platform (UWP).
Visual Studio Code is a powerful and lightweight source code editor that runs on your desktop. Visual Studio Code is available for Windows, macOS, and Linux. While Visual Studio Code doesn't come with an automated . NET Core installer like Visual Studio does, adding .
NET Core RC2, you'll obviously want to update your tools—in this case Visual Studio 2015—to support the new platform. This essentially involves two steps: Downloading the . NET Core Tooling Preview 1 for Visual Studio 2015 from microsoft.com/net/core#windows (where you'll also find instructions).
MVC 6 was part of ASP.NET 5, but due to some major changes in the code base, they decided to change its name from ASP.NET 5 to ASP.NET Core. Save this answer.
I think there is a bug in the Microsoft.NET.Publish.targets file.
I changed the DestinationFiles line (line 99 and 127) as below, and now it works
<Copy SourceFiles = "@(_ResolvedFileToPublishAlways)"
DestinationFiles="@(_ResolvedFileToPublishAlways -> '$(PublishDir)%(RelativePath)')"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">
This is a known bug and is mentioned in the VS2017 RC Tooling Known Issues document:
Unable to publish
Unable to publish ASP.NET Core Web Application (.NET Framework)
- Issue:
If you try to publish an ASP.NET Core Web Application (.NET Framework), you will run into the following error: "DestinationFiles" refers to 1 item(s), and "SourceFiles" refers to 2 item(s). They must have the same number of items
- Workaround:
None available
https://github.com/aspnet/Tooling/blob/master/known-issues-vs2017.md
Look back later to see if a workaround is provided.
Editing "Microsoft.NET.Publish.targets" in folder "C:\Program Files\dotnet\sdk\1.0.0-preview4-004233\Sdks\Microsoft.NET.Sdk\build" didn't work for me though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With