Build Failing when Publishing to SmarterASP.net - c#

I was able to publish my web app a while ago, and I'm coming back to it now. I've made some changes, not totally sure what all together now, and it just keeps failing. It gives me this in the log file:
5/4/2020 5:34:53 PM
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.
===================
And in the output window, it just says it failed trying to delete a file. I've tried publishing with deleting everything and without, both fail the same way.
I can build locally just fine.

SmarterASP.net often has issue with certificate and you have to reaccept it.
Note:If you get certificate error with publish,please add below code
to your PublishProfiles.
<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
SmarterASP.net Knowledge base reference

Related

Error while accessing Publish in Visual Studio 2019 ASP.NET project

While publishing ASP.NET project locally I got the error shown below.
I tried to folder or FileShare.
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__202.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.

Publishing WPF .Net Core 3 app and Serilog.Sinks.File

NuGet package Serilog.Sinks.File gives an error when publishing.
I am trying to publish a self-contained WPF .NET Core 3.0 app. The app builds, runs fine publishes fine until Serilog.Sinks.File is added. Once Serilog.Sinks.File is added to the project, the app builds/runs and even logs correctly. However, when trying to publish this error is given;
System.AggregateException: One or more errors occurred. --->
System.Exception: Publishing failed. --- 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.Publish.Framework.Model.DefaultPublishSteps.<>c__DisplayClass26_0.b__2()
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.Model.DefaultPublishSteps.d__23.MoveNext()
--- 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__205.MoveNext()
---> (Inner Exception #0) System.Exception: Publishing failed.<---
System.Exception: Publishing failed.
===================
Remove Serilog.Sinks.File and the app publishes.
Even removing the Serilog initialize command and the same error occurs.
I found the solution turns out that Serilog.Sinks.File is not the correct Nuget package. You need to use Serilog.AspNetCore and then the app is able to publish.

ASP.NET Core 2.1 App succeeds in Building and Running Locally but fails to Publish to IIS via Web Deploy

I have a .NET Core 2.1 App that I want to publish on IIS8 via WebDeploy. When I publish, this is the error I get:
Severity Code Description Project File Line Suppression State
Error Web deployment task failed. ((1/15/2019 2:18:40 PM) An error occurred when the request was processed on the remote computer.)
(1/15/2019 2:18:40 PM) An error occurred when the request was
processed on the remote computer. The server experienced an issue
processing the request. Contact the server administrator for more
information. ManagementStudio C:\Program
Files\dotnet\sdk\2.1.503\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets 139
I tried looking around and found this in the temp file
1/15/2019 3:01:59 PM 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.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass43_0.b__2()
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.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.d__127.MoveNext()
---> (Inner Exception #0) System.Exception: Build failed. Check the Output window for more details.<---
===================
I'm not sure what I'm doing wrong? I can run it locally but am I missing something? I've looked around and it seems like this error doesn't happen often?
I solved this problem just by updating the "TypeScript SDK for Visual Studio 2017" from
https://www.microsoft.com/en-us/download/details.aspx?id=55258

C# .NET MVC cannot publish the project

I cannot publish as File System.
Temp file shown that
10/26/2018 5:13:04 PM 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.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass43_0.b__2()
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.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.d__127.MoveNext()
---> (Inner Exception #0) System.Exception: Build failed. Check the Output window for more details.<---
===================
You can try publishing via cmd. open cmd on the project root path and run this command
dotnet publish -c Release -r win10-x64
this will create publish folder at bin\Release\netcoreapp2.0\win10-x64\publish
I got same error when migrate my project 2.1 to 2.2. It worked on local well. Then I have solved it with;
Remove publish profile
Create new publish profile
That is it. VS kept old profile with old dotnet core version.

Problem in Publishing my ASP.NET MVC project using Visual Studio 2017

I am uisng Vsiual Studio 2017 for my project, and when I want to publish the project I get the below error: any one please help.
Publish has encountered and error! publish failed due to build errors.
A diagnostic log has been written to the following location: "C:\Users\ABC\AppData\Local\Temp\tem413.temp"
The output log for tem413.temp is
System.AggregateException: One or more errors occurred. ---> System.Exception: Publish failed due to build errors. Check the error list 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.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass40_0.b__2()
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.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.d__108.MoveNext()
---> (Inner Exception #0) System.Exception: Publish failed due to build errors. Check the error list for more details.<---
Thanks

Categories