Aspnetcore: " rzc generate exited with code 1" when updtating packages on VS2017 Blazor template

Created on 24 Apr 2018  路  5Comments  路  Source: dotnet/aspnetcore

Title

When we try to update all the packages on the VS2017 preview template for Blazor we can't build our project.

Functional impact

Unable to create a new project with Blazor latest features as the template targets "Microsoft.AspNetCore.Blazor.Build" version 0.10

Minimal repro steps

  1. Open VS201715.7.0 preview 4*
  2. New project Asp.Net core => Blazor (asp.net core hosted)
  3. Right click on solution => Manage package
  4. Install all the updates
  5. Build solution

Expected result

Build succeeded

Actual result

Build failed

Output shows

2>   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor)
2>   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
2>   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
2>   at System.Activator.CreateInstance(Type type)
2>   at Microsoft.AspNetCore.Razor.Language.AssemblyExtension.CreateInitializer()
2>   at Microsoft.AspNetCore.Razor.Language.RazorProjectEngine.LoadExtensions(RazorProjectEngineBuilder builder, IReadOnlyList`1 extensions)
2>   at Microsoft.AspNetCore.Razor.Language.RazorProjectEngine.Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem, Action`1 configure)
2>   at Microsoft.AspNetCore.Razor.Tools.GenerateCommand.ExecuteCore(RazorConfiguration configuration, String projectDirectory, String tagHelperManifest, List`1 sources, List`1 outputs, List`1 relativePaths)
2>   at Microsoft.AspNetCore.Razor.Tools.GenerateCommand.ExecuteCoreAsync()
2>   at Microsoft.AspNetCore.Razor.Tools.CommandBase.<ExecuteAsync>d__10.MoveNext()
2>C:\Users\remi\.nuget\packages\microsoft.aspnetcore.blazor.build\0.2.1\targets\RazorCompilation.targets(187,5): error : rzc generate exited with code 1.
2>G茅n茅ration du projet "BlazorEmpty.Client.csproj" termin茅e -- 脡CHEC.
3>------ D茅but de la g茅n茅ration : Projet : BlazorEmpty.Server, Configuration : Debug Any CPU ------

"dotnet --info" output

Product Information:
 Version:            2.1.200-preview-007576
 Commit SHA-1 hash:  bd3372b5a3

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.200-preview-007576\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.7
  Build    : 2d61d0b043915bc948ebf98836fefe9ba942be11
area-blazor

Most helpful comment

Another note for anyone hitting this... This is a problem with the Razor tools that pops up when you try to use multiple versions of a Razor extension across the lifetime of the Razor build server.

This is a bug in 2.1.0-preview2 Razor and will be resolved in the RC. This case will correctly fall back to the slow path when it can't load the Blazor extension.

You can work around this problem by killing all dotnet processes, or killing the one executing rzc.dll

All 5 comments

Looks like your .NET Core SDK version is out of date. To work with Blazor 0.2.0 you need 2.1.300-preview2-008533 (see https://blazor.net/docs/get-started.html).

Also make sure you are pulling packages from nuget.org.

Another note for anyone hitting this... This is a problem with the Razor tools that pops up when you try to use multiple versions of a Razor extension across the lifetime of the Razor build server.

This is a bug in 2.1.0-preview2 Razor and will be resolved in the RC. This case will correctly fall back to the slow path when it can't load the Blazor extension.

You can work around this problem by killing all dotnet processes, or killing the one executing rzc.dll

Indeed I resolved it by installing the good sdk and targeting an other version of razor tools

Encountering this using:

  • VS2017 V 15.9.5
  • Blazor 0.7
  • SDK: .Net Core 3.0.0-preview-27122-01 (upgraded to this to overcome a runtime bug)

i use aspnetcore 3.0 preview AND
Hey!!! Because of ~ character in .cshtml file

when i dont use ~. it works

<a href="~/Images/gallery/1.jpg" title="Image from Unsplash" data-gallery=""><img src="~/Images/gallery/1s.jpg"></a>

Was this page helpful?
0 / 5 - 0 ratings