question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blazor Library template does not build.

See original GitHub issue

Trying to build the Blazor Library (blazorlib) template produces the following error.

rzc generate exited with code 1.

To Reproduce

  1. Create a new solution.
  2. dotnet new blazorlib
  3. Add the project to the solution.
  4. Try to build the project.

Expected behavior

The project should build.

Additional context

.NET Core SDK (reflecting any global.json): Version: 3.0.100-preview4-011223 Commit: 118dd862c8

Runtime Environment: OS Name: Windows OS Version: 10.0.17134 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview4-011223\

Host (useful for support): Version: 3.0.0-preview4-27615-11 Commit: ee54d4cbd2

.NET Core SDKs installed: 2.1.602 [C:\Program Files\dotnet\sdk] 2.1.700-preview-009601 [C:\Program Files\dotnet\sdk] 2.2.202 [C:\Program Files\dotnet\sdk] 3.0.100-preview4-011223 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.0-preview4-19216-03 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.0-preview4-27615-11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.0.0-preview4-27613-28 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]


Microsoft Visual Studio Community 2019 Preview Version 16.1.0 Preview 2.0 VisualStudio.16.Preview/16.1.0-pre.2.0+28822.285 Microsoft .NET Framework Version 4.7.03056

Installed Version: Community

Application Insights Tools for Visual Studio Package 9.0.20307.1 Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2019 16.1.302.53887 ASP.NET and Web Tools 2019

ASP.NET Core Blazor Language Services 16.0.19216.03

ASP.NET Web Frameworks and Tools 2019 16.1.302.53887 For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.1.302.53887 Azure App Service Tools v3.0.0

C# Tools 3.1.0-beta2-19211-01+9d88fee4efb9f7ae4ae053d63b9f8b5b31217c90 C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

IntelliCode Extension 1.0 IntelliCode Visual Studio Extension Detailed Info

Microsoft Continuous Delivery Tools for Visual Studio 0.4 Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 1.0 Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers 1.1 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

NuGet Package Manager 5.1.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info

ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info

ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info

SQL Server Data Tools 16.0.61904.17120 Microsoft SQL Server Data Tools

TypeScript Tools 16.0.10411.2001 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.1.0-beta2-19211-01+9d88fee4efb9f7ae4ae053d63b9f8b5b31217c90 Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.4 for F# 4.6 16.0.0.0. Commit Hash: 809f41207b74a1356208f11b8fa3a15233734050. Microsoft Visual F# Tools 10.4 for F# 4.6

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
rjmr97commented, Apr 27, 2019

You probably have the wrong version of Microsoft.AspNetCore.Blazor.Templates, that’s why you have the wrong package versions.

Can you run the following commands and tell me if it works?

> dotnet new -u Microsoft.AspNetCore.Blazor.Templates
> dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.0.0-preview4-19216-03
> dotnet new blazorlib
> dotnet build

Your .csproj should look something like this: (notice how now it uses Microsoft.AspNetCore.Components.Browser)

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

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <IsPackable>true</IsPackable>
    <RestoreAdditionalProjectSources>
      https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
      https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;
    </RestoreAdditionalProjectSources>
    <LangVersion>7.3</LangVersion>
    <RazorLangVersion>3.0</RazorLangVersion>
    <AddRazorSupportForMvc>true</AddRazorSupportForMvc>
  </PropertyGroup>

  <ItemGroup>
    <!-- .js/.css files will be referenced via <script>/<link> tags; other content files will just be included in the app's 'dist' directory without any tags referencing them -->
    <EmbeddedResource Include="content\**\*.js" LogicalName="blazor:js:%(RecursiveDir)%(Filename)%(Extension)" />
    <EmbeddedResource Include="content\**\*.css" LogicalName="blazor:css:%(RecursiveDir)%(Filename)%(Extension)" />
    <EmbeddedResource Include="content\**" Exclude="**\*.js;**\*.css" LogicalName="blazor:file:%(RecursiveDir)%(Filename)%(Extension)" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.Browser" Version="3.0.0-preview4-19216-03" />
  </ItemGroup>

</Project>
1reaction
sanny-iocommented, Apr 28, 2019

@rjmr97 That worked for me too 👍 Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

blazor template can't build on cli
Try to update Blazor templates and create Blazor Server App or Blazor WebAssembly App. Install latest Templates. Copy. dotnet new --install ...
Read more >
Blazor Library template does not build. · Issue #9800
Trying to build the Blazor Library (blazorlib) template produces the following error. rzc generate exited with code 1. To Reproduce Create a ...
Read more >
c# - I just see project template blazorserver, Why I don't ...
The client-side Blazor templates are not yet built-in to ASP.NET Core as client-side Blazor isn't fully finished yet.
Read more >
Missing Blazor templates, and how I found them (eventually ...
No problem, just create a Blazor Library. Except I don't have a template for one of those! For some reason, it seems you...
Read more >
A Developer's Guide To Blazor Component Libraries
Learn how to create Blazor components libraries with reusable components, static images, stylesheets etc. and consume them in Blazor Apps.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found