dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.39k stars 10k forks source link

.NET 6 rc and Blazor Web Assembly Publish fails from Visual Studio #36641

Closed apsthisdev closed 3 years ago

apsthisdev commented 3 years ago

.NET SDK 6.0.100-rc.1 Full version 6.0.100-rc.1.21458.32

Visual Studio 2022 Preview 4 (Latest Preview)

Describe the bug

The Blazor Stanalone Web Assembly project fails to publish to Azure web app after moving to

Build started...
1>------ Publish started: Project: TestC.Web.Client, Configuration: Release Any CPU ------
Determining projects to restore...
C:\Program Files\dotnet\sdk\6.0.100-rc.1.21458.32\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): Error NETSDK1147: To build this project, the following workloads must be installed: wasm-tools
To install these workloads, run the following command: dotnet workload install wasm-tools
C:\Program Files\dotnet\sdk\6.0.100-rc.1.21458.32\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): Error NETSDK1147: To build this project, the following workloads must be installed: wasm-tools
To install these workloads, run the following command: dotnet workload install wasm-tools
C:\Program Files\dotnet\sdk\6.0.100-rc.1.21458.32\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): Error NETSDK1147: To build this project, the following workloads must be installed: wasm-tools
To install these workloads, run the following command: dotnet workload install wasm-tools
C:\Program Files\dotnet\sdk\6.0.100-rc.1.21458.32\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): Error NETSDK1147: To build this project, the following workloads must be installed: wasm-tools
To install these workloads, run the following command: dotnet workload install wasm-tools
You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
C:\Program Files\dotnet\sdk\6.0.100-rc.1.21458.32\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(246,5): Error NETSDK1064: Package Microsoft.AspNetCore.Components.Analyzers, version 6.0.0-preview.4.21253.5 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.

Why is wasm-tools not installed as part of SDK ?

javiercn commented 3 years ago

@ameyasubhedar thanks for contacting us.

I believe its an optional workload. @pranavkm what's the right gesture to get them installed?

apsthisdev commented 3 years ago

@javiercn, @pranavkm , manually installing the workload does fix the issue. But as per the docs, this workload should be installed as part of workload.

image

javiercn commented 3 years ago

@radical @vijayrkn do you have any thoughts?

vijayrkn commented 3 years ago

@ameyasubhedar - After you select the web workload, you need to select the highlighted component as well:

image

Let us know if this doesn't fix the issue.

javiercn commented 3 years ago

@ameyasubhedar can you point to the docs you were following so that we can get them updated? Seems like this is by design.

apsthisdev commented 3 years ago

Here is the doc link https://docs.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-6.0&pivots=windows

javiercn commented 3 years ago

@ameyasubhedar thanks, I don't see anywhere there where it mentions that the wasm tools need to be installed.

Are you trying to build a regular app or are you explicitly trying to ahead of time compile the app.

apsthisdev commented 3 years ago

Its a standalone regular Blazor WebAssembly, I have disabled AOT, but publish failed, And this only happens in .NET6 preview or rx. Verified that .NET5 works out of the box.

image

vijayrkn commented 3 years ago

@ameyasubhedar - is there any additional settings in the project file?

apsthisdev commented 3 years ago

The same issue is happening with Azure Pipeline. On local machine I have the tools manually isntalled. How do I resolve this issue in Azure Pipleline Build ?

2021-09-17T19:50:52.5323452Z ##[section]Starting: Publish
2021-09-17T19:50:52.5450179Z ==============================================================================
2021-09-17T19:50:52.5450472Z Task         : .NET Core
2021-09-17T19:50:52.5450753Z Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
2021-09-17T19:50:52.5451033Z Version      : 2.187.0
2021-09-17T19:50:52.5451243Z Author       : Microsoft Corporation
2021-09-17T19:50:52.5451545Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
2021-09-17T19:50:52.5451900Z ==============================================================================
2021-09-17T19:50:53.1627476Z [command]C:\Windows\system32\chcp.com 65001
2021-09-17T19:50:53.1743007Z Active code page: 65001
2021-09-17T19:50:53.1785303Z 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.
2021-09-17T19:50:54.0707366Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe publish D:\a\9\s\src\TestC.Web.Client\TestC.Web.Client.csproj --configuration Release --output D:\a\9\a\TestC.Web.Client -r browser-wasm --self-contained true
2021-09-17T19:50:54.2962184Z Microsoft (R) Build Engine version 17.0.0-preview-21458-01+2c5510013 for .NET
2021-09-17T19:50:54.3290024Z Copyright (C) Microsoft Corporation. All rights reserved.
2021-09-17T19:50:54.3297955Z 
2021-09-17T19:50:54.9007054Z   Determining projects to restore...
2021-09-17T19:50:55.1629652Z C:\hostedtoolcache\windows\dotnet\sdk\6.0.100-rc.1.21458.32\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: wasm-tools [D:\a\9\s\src\TestC.Data.Components\TestC.Data.Components.csproj]
2021-09-17T19:50:55.1633699Z C:\hostedtoolcache\windows\dotnet\sdk\6.0.100-rc.1.21458.32\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload install wasm-tools [D:\a\9\s\src\TestC.Data.Components\TestC.Data.Components.csproj]
2021-09-17T19:50:55.3224684Z ##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1
2021-09-17T19:50:55.3227725Z ##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build
2021-09-17T19:50:55.3230650Z Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . 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
2021-09-17T19:50:55.3233221Z ##[error]Dotnet command failed with non-zero exit code on the following projects : D:\a\9\s\src\TestC.Web.Client\TestC.Web.Client.csproj
2021-09-17T19:50:55.3354646Z ##[section]Finishing: Publish

Here is the csproj file.

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

    <PropertyGroup Label="Globals">
        <SccProjectName>SAK</SccProjectName>
        <SccProvider>SAK</SccProvider>
        <SccAuxPath>SAK</SccAuxPath>
        <SccLocalPath>SAK</SccLocalPath>
        <Configurations>Debug;Release</Configurations>
    </PropertyGroup>

    <Import Project="..\..\build\props\App.props" />

    <PropertyGroup>
        <TargetFramework>net6.0</TargetFramework>
        <Nullable>enable</Nullable>
    </PropertyGroup>

    <PropertyGroup Label="PiPackageProps">
        <Product>Client</Product>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
        <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0-rc.1.21452.15" />
        <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0-rc.1.21452.15" PrivateAssets="all" />
        <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="6.0.0-rc.1.21452.15" />
    </ItemGroup>

    <ItemGroup>
        <ProjectReference Include="..\TestC.Data.Components\TestC.Data.Components.csproj" />
        <ProjectReference Include="..\TestC.Protocols.Defaults\TestC.Protocols.Defaults.csproj" />
    </ItemGroup>

    <!--
        https://github.com/dotnet/aspnetcore/issues/29524
        bundleconfig.json is a tooling asset not a runtime asset, so we do not deploy it.
        Other projects may also contain bundleconfig.json and if we deploy it then there is a conflict at the root folder.
    -->
    <ItemGroup>
        <Content Update="bundleconfig.json">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
            <CopyToPublishDirectory>Never</CopyToPublishDirectory>
        </Content>
    </ItemGroup>

    <ItemGroup>
      <Folder Include="Services\" />
    </ItemGroup>

</Project>
vijayrkn commented 3 years ago

@joeloff - What is the cli command to install the WASM tools work-load?

joeloff commented 3 years ago

dotnet workload install wasm-tools

radical commented 3 years ago

@ameyasubhedar Could you add -bl to your build command line, and share the generated msbuild.binlog?

apsthisdev commented 3 years ago

dotnet workload install wasm-tools fails in Azure Pipiline classic editor....

Tried both "C:\Program Files\dotnet\dotnet.exe" "dotnet workload install wasm-tools" and "C:\Program Files\dotnet\dotnet.exe" "workload install wasm-tools"

Starting: dotnet custom
==============================================================================
Task         : .NET Core
Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version      : 2.187.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.
"C:\Program Files\dotnet\dotnet.exe" "dotnet workload install wasm-tools"
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet-dotnet workload install wasm-tools does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . 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 : 
Finishing: dotnet custom
2021-09-17T22:04:23.7303506Z ##[section]Starting: dotnet custom
2021-09-17T22:04:23.7533578Z ==============================================================================
2021-09-17T22:04:23.7533892Z Task         : .NET Core
2021-09-17T22:04:23.7534163Z Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
2021-09-17T22:04:23.7534416Z Version      : 2.187.0
2021-09-17T22:04:23.7534603Z Author       : Microsoft Corporation
2021-09-17T22:04:23.7534875Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
2021-09-17T22:04:23.7535345Z ==============================================================================
2021-09-17T22:04:24.8093102Z [command]C:\Windows\system32\chcp.com 65001
2021-09-17T22:04:24.8282544Z Active code page: 65001
2021-09-17T22:04:24.8363000Z 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.
2021-09-17T22:04:24.8368973Z [command]"C:\Program Files\dotnet\dotnet.exe" "workload install wasm-tools"
2021-09-17T22:04:26.0185973Z Could not execute because the specified command or file was not found.
2021-09-17T22:04:26.0186873Z Possible reasons for this include:
2021-09-17T22:04:26.0187178Z   * You misspelled a built-in dotnet command.
2021-09-17T22:04:26.0187522Z   * You intended to execute a .NET program, but dotnet-workload install wasm-tools does not exist.
2021-09-17T22:04:26.0188655Z   * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
2021-09-17T22:04:26.0411569Z ##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
2021-09-17T22:04:26.0423417Z Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . 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
2021-09-17T22:04:26.0425476Z ##[error]Dotnet command failed with non-zero exit code on the following projects : 
2021-09-17T22:04:26.0504500Z ##[section]Finishing: dotnet custom

Also why do i need to install wasm_tools at the first place if the Blazor Webassembly project does not enable AOT ?

ghost commented 3 years ago

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.