blazor template can't build on cli

ram dem 31 Reputation points
2020-12-22T12:23:52.347+00:00

Hello
dotnet new build blazor creates project.
When building with dotnet;

C:\Users\ramdem.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\targets\RazorCompilation.targets(184,5): Error: rzc generate exited with code 1.

Project build fails
.
Also Nuget reports package "microsoft.aspnetcore.blazor.build"is deprecated.

is there a solution here?

I'm confused, Visual studio template uses netcoreapp3.1 and build and run okey. But dotnet cli uses netstandard2.0 it fails.

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,395 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Wang-MSFT 1,051 Reputation points
    2020-12-23T07:03:50.143+00:00

    Hi, @ram dem ,

    Blazor template have been renamed. You can read more about that change in the 'Blazor templates renamed and simplified' section in the Preview 8 Release Blog Post.

    50950-image.png

    Try to update Blazor templates and create Blazor Server App or Blazor WebAssembly App.

    1. Install latest Templates
      dotnet new --install Microsoft.DotNet.Web.ProjectTemplates.3.1::3.1.10  
      

    dotnet new --install Microsoft.DotNet.Web.ProjectTemplates.3.1::3.1.10
    Determining projects to restore...
    C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp1.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\michaelw2.templateengine\dotnetcli\v5.0.100\scratch\restore.csproj]
    Restored C:\Users\michaelw2.templateengine\dotnetcli\v5.0.100\scratch\restore.csproj (in 8.68 sec).

    Templates Short Name Language Tags


    Console Application console [C#], F#, VB Common/Console
    Class library classlib [C#], F#, VB Common/Library
    WPF Application wpf [C#], VB Common/WPF
    WPF Class library wpflib [C#], VB Common/WPF
    WPF Custom Control Library wpfcustomcontrollib [C#], VB Common/WPF
    WPF User Control Library wpfusercontrollib [C#], VB Common/WPF
    Windows Forms App winforms [C#], VB Common/WinForms
    Windows Forms Control Library winformscontrollib [C#], VB Common/WinForms
    Windows Forms Class Library winformslib [C#], VB Common/WinForms
    Worker Service worker [C#], F# Common/Worker/Web
    Unit Test Project mstest [C#], F#, VB Test/MSTest
    NUnit 3 Test Project nunit [C#], F#, VB Test/NUnit
    NUnit 3 Test Item nunit-test [C#], F#, VB Test/NUnit
    xUnit Test Project xunit [C#], F#, VB Test/xUnit
    Razor Component razorcomponent [C#] Web/ASP.NET
    Razor Page page [C#] Web/ASP.NET
    MVC ViewImports viewimports [C#] Web/ASP.NET
    MVC ViewStart viewstart [C#] Web/ASP.NET
    Blazor Server App blazorserver [C#] Web/Blazor
    Blazor (ASP.NET Core hosted) blazorhosted [C#] Web/Blazor/Hosted
    Blazor Library blazorlib [C#] Web/Blazor/Library
    Blazor (client-side) blazor [C#] Web/Blazor/Standalone
    Blazor WebAssembly App blazorwasm [C#] Web/Blazor/WebAssembly
    ASP.NET Core Empty web [C#], F# Web/Empty
    ASP.NET Core Web App (Model-View-Controller) mvc [C#], F# Web/MVC
    ASP.NET Core Web App webapp [C#] Web/MVC/Razor Pages
    ASP.NET Core with Angular angular [C#] Web/MVC/SPA
    ASP.NET Core with React.js react [C#] Web/MVC/SPA
    ASP.NET Core with React.js and Redux reactredux [C#] Web/MVC/SPA
    Razor Class Library razorclasslib [C#] Web/Razor/Library
    ASP.NET Core Web API webapi [C#], F# Web/WebAPI
    ASP.NET Core gRPC Service grpc [C#] Web/gRPC
    dotnet gitignore file gitignore Config
    global.json file globaljson Config
    NuGet Config nugetconfig Config
    Dotnet local tool manifest file tool-manifest Config
    Web Config webconfig Config
    Solution File sln Solution
    Protocol Buffer File proto Web/gRPC

    Examples:
    dotnet new mvc --auth Individual
    dotnet new xunit
    dotnet new --help
    dotnet new blazorserver --help

    1. Create Blazor app
      dotnet new blazorserver -o BlazorApp  
      

    PS D:\BlazorApp> dotnet new blazorserver
    The template "Blazor Server App" was created successfully.
    This template contains technologies from parties other than Microsoft, see https://aka.ms/aspnetcore/5.0-third-party-notices for details.

    Processing post-creation actions...
    Running 'dotnet restore' on D:\BlazorApp\BlazorApp.csproj...
    Determining projects to restore...
    Restored D:\BlazorApp\BlazorApp.csproj (in 67 ms).
    Restore succeeded.

    1. Build and run app dotnet build
      dotnet run

    PS D:\BlazorApp> dotnet build
    Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET
    Copyright (C) Microsoft Corporation. All rights reserved.

    Determining projects to restore...
    All projects are up-to-date for restore.
    BlazorApp -> D:\BlazorApp\bin\Debug\net5.0\BlazorApp.dll
    BlazorApp -> D:\BlazorApp\bin\Debug\net5.0\BlazorApp.Views.dll

    Build succeeded.
    0 Warning(s)
    0 Error(s)

    Time Elapsed 00:00:09.00
    PS D:\BlazorApp> dotnet run
    Building...
    info: Microsoft.Hosting.Lifetime[0]
    Now listening on: https://localhost:5001
    info: Microsoft.Hosting.Lifetime[0]
    Now listening on: http://localhost:5000
    info: Microsoft.Hosting.Lifetime[0]
    Application started. Press Ctrl+C to shut down.
    info: Microsoft.Hosting.Lifetime[0]
    Hosting environment: Development
    info: Microsoft.Hosting.Lifetime[0]
    Content root path: D:\BlazorApp

    50920-image.png


    If the answer doesn’t solve your issue, please provide more details of error that will help us track down what’s happening.
    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,
    Michael Wang

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. ram dem 31 Reputation points
    2020-12-23T14:47:12.287+00:00

    Thank you for answer miwan2

    Best Regards,

    0 comments No comments