excubo-ag / WebCompiler

Apache License 2.0
148 stars 29 forks source link

Error publishing blazor webassembly project when using WebCompiler in azure pipelines #46

Closed rkieslinger closed 2 years ago

rkieslinger commented 2 years ago

Hello!

I'm using the following command to compile scss files in my blazor webassembly project: dotnet tool run webcompiler --files scssCompileFiles.conf --zip disable

If I do this in my azure pipeline, I get the following error:

Starting: dotnet publish
==============================================================================
Task         : .NET Core
Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version      : 2.174.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
==============================================================================
C:\Windows\system32\chcp.com 65001
Active code page: 65001
Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
D:\core-1-2\_tool\dotnet\dotnet.exe publish D:\core-1-2\1\s\src\AppMon.Services.Api\AppMon.Services.Api.csproj --configuration release --output D:\core-1-2\1\a\AppMon.Services.Api
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored D:\core-1-2\1\s\src\AppMon.Services.Shared\AppMon.Services.Shared.csproj (in 89 ms).
  Restored D:\core-1-2\1\s\src\AppMon.Services.Entities\AppMon.Services.Entities.csproj (in 89 ms).
  Restored D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj (in 1,04 sec).
  Restored D:\core-1-2\1\s\src\AppMon.Services.Persistence\AppMon.Services.Persistence.csproj (in 1,5 sec).
  Restored D:\core-1-2\1\s\src\AppMon.Services.Api\AppMon.Services.Api.csproj (in 1,63 sec).
  AppMon.Services.Entities -> D:\core-1-2\1\s\src\AppMon.Services.Entities\bin\release\net5.0\AppMon.Services.Entities.dll
  AppMon.Services.Shared -> D:\core-1-2\1\s\src\AppMon.Services.Shared\bin\release\net5.0\AppMon.Services.Shared.dll
  AppMon.Services.Persistence -> D:\core-1-2\1\s\src\AppMon.Services.Persistence\bin\release\net5.0\AppMon.Services.Persistence.dll
  Tool 'excubo.webcompiler' (version '2.7.14') was restored. Available commands: webcompiler

  Restore was successful.
  AppMon.Services.App -> D:\core-1-2\1\s\src\AppMon.Services.App\bin\release\net5.0\AppMon.Services.App.dll
  AppMon.Services.App (Blazor output) -> D:\core-1-2\1\s\src\AppMon.Services.App\bin\release\net5.0\wwwroot
  AppMon.Services.Api -> D:\core-1-2\1\s\src\AppMon.Services.Api\bin\release\net5.0\AppMon.Services.Api.dll
  AppMon.Services.Api -> D:\core-1-2\1\s\src\AppMon.Services.Api\bin\release\net5.0\AppMon.Services.Api.Views.dll
  Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018: The "GenerateServiceWorkerAssetsManifest" task failed unexpectedly. [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018: System.AggregateException: One or more errors occurred. (Could not find a part of the path 'D:\core-1-2\1\s\src\AppMon.Services.App\obj\release\net5.0\scopedcss\bundle\AppMon.Services.App.styles.css'.) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:  ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\core-1-2\1\s\src\AppMon.Services.App\obj\release\net5.0\scopedcss\bundle\AppMon.Services.App.styles.css'. [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at System.IO.File.OpenRead(String path) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at Microsoft.NET.Sdk.BlazorWebAssembly.GenerateServiceWorkerAssetsManifest.<>c__DisplayClass17_0.<GenerateAssetManifest>b__0(Int32 i) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018: --- End of stack trace from previous location --- [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at System.Threading.Tasks.TaskReplicator.Replica.Execute() [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    --- End of inner exception stack trace --- [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018: --- End of stack trace from previous location --- [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at System.Threading.Tasks.Parallel.For(Int32 fromInclusive, Int32 toExclusive, Action`1 body) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at Microsoft.NET.Sdk.BlazorWebAssembly.GenerateServiceWorkerAssetsManifest.GenerateAssetManifest(Stream stream) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at Microsoft.NET.Sdk.BlazorWebAssembly.GenerateServiceWorkerAssetsManifest.Execute() [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
D:\core-1-2\_tool\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets(140,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [D:\core-1-2\1\s\src\AppMon.Services.App\AppMon.Services.App.csproj]
##[error]Error: The process 'D:\core-1-2\_tool\dotnet\dotnet.exe' failed with exit code 1
##[warning]Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x (3.1) SDK/Runtime along with 2.1. Unless you have locked down a SDK version for your project(s), 3.x SDK might be picked up which might have breaking behavior as compared to previous versions. 
Some commonly encountered changes are: 
If you're using `Publish` command with -o or --Output argument, you will see that the output folder is now being created at root directory rather than Project File's directory. To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
##[error]Dotnet command failed with non-zero exit code on the following projects : D:\core-1-2\1\s\src\AppMon.Services.Api\AppMon.Services.Api.csproj
Finishing: dotnet publish
stefanloerwald commented 2 years ago

Hi @rkieslinger,

Looking at the log, I can't see any fault of webcompiler here. All errors are reported by the .NET SDK.

From the log, I can't identify when webcompiler was executed. The only output related to webcompiler is the installation (restore).

Can you provide additional information? When and how do you call the tool? Can you list files before/after the call to see whether the files get created as expected?

BR Stefan

rkieslinger commented 2 years ago

Thanks for the fast response! I tried a few things and it seems I found a solution/workaround :)