3

The application which I'm working now was developed in VS 2015. I'm trying to run the same in VS 2019, the build succeeded but fails when trying to publish via FTP / to the local folder as well.

A diagnostic log has been written to the following location .tmp file.

System.AggregateException: One or more errors occurred.

System.Exception: Build failed. Check the Output window for more details.
--- End of inner exception stack trace ---

at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.WebTools.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass43_0.b__3()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.d__213.MoveNext()

(Inner Exception #0) System.Exception: Build failed. Check the Output window for more details.

System.Exception: Build failed. Check the Output window for more details.

The following are the details in the Output window.

1>------ Build started: Project: EmpDetails.BAL, Configuration: Release Any CPU ------
1>  EmpDetails.BAL -> C:\Test\Projects\source\repos\Project\EmpDetails.BAL\bin\Release\EmpDetails.BAL.dll
2>------ Build started: Project: EmployeeDetails, Configuration: Release Any CPU ------
2>  EmployeeDetails -> C:\Test\Projects\source\repos\Project\EmployeeDetails\bin\EmployeeDetails.dll
3>------ Publish started: Project: EmployeeDetails, Configuration: Release Any CPU ------
3>Connecting to C:\Test\Projects\ProjName\Published Website...
3>
========== Build: 2 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

I googled the same and tried the following

  1. run Visual studio in administrator mode.
  2. Give read/write privileges to the destination folder.
  3. Shorter the URL path
  4. Set "Build + Intellisense" in Error list.

Nothing works.

But when I created the sample application in VS 2019 and I'm able to publish it.

Just a thought, do I have to change/update anything in Web.config file.

I'm struggling to fix this issue for past two days. How to fix it?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Krish
  • 167
  • 1
  • 3
  • 16
  • 5
    it says `Build failed. Check the Output window for more details.` -- did you do that? Take the text from the `Output` window and copy and paste it in your question. – Andy Aug 08 '20 at 17:52
  • @Andy , As you suggested, I have updated the question with the details of Output window. – Krish Aug 09 '20 at 12:03
  • Here is a [workaround](https://stackoverflow.com/a/48583412/8335151). Maybe you can refer to it. – 大陸北方網友 Aug 10 '20 at 02:12
  • Your original message says build failed but your output window says all builds succeeded. Are you able to determine whether a build failed? – Nick.Mc Jun 19 '22 at 05:55

4 Answers4

1

May be helpful for someone. I had this same issue when i publish my application also. And the weird thing is it solved when i added this to my package reference in .csproj file

    <PackageReference Include="EFCore.BulkExtensions" Version="5.2.8" />

After adding this package reference, when i rebuild and publish, it is working.

RABI
  • 692
  • 2
  • 15
1

Recently I came across a similar issue in Visual Studio 2022. At the end of the publish process, I got an error with a build failed and ask me to check temp file generated for more details, and it looks like the below,

 System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.
--- End of inner exception stack trace ---
---> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.<---

Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.

===================

In the output window, it was showing that there was an issue with copying a few files because the system wasn't able to find those files even though the files were there in the directory.

In my case, the issue was, the paths were too long for those files. So I changed the root folder short and it published successfully.

In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters. A local path is structured in the following order: drive letter, colon, backslash, name components separated by backslashes, and a terminating null character. For example, the maximum path on drive D is "D:\some 256-character path string" where "" represents the invisible terminating null character for the current system codepage. (The characters < > are used here for visual clarity and cannot be part of a valid path string.)

Microsoft Documentation: Maximum Path Length Limitation

SilentCoder
  • 1,970
  • 1
  • 16
  • 21
0

In my case this error because of some files that are exist in project(csproj) but were deleted physically. remove them from project and publish again.

In addition in output window show the error's description.

Mehdi
  • 520
  • 1
  • 5
  • 9
0

In my case I have Image directory and which has containing large files, So I just exclude from solution and republish then it's publish successfully.

Arun Solanki
  • 174
  • 11