Build Razor project "rzc generate exited with code 129"

255 Views Asked by At

I am trying to build an "old" Razor project on my Macbook Pro (M1) with Visual Studio 2022 for Mac (17.4).

The solution is composed of several projects. They all build except the Razor project.

I get the following error: rzc generate exited with code 129.

If I look at the build output I have this:

Target RazorGenerateComponentDeclaration:
    /usr/local/share/dotnet/dotnet exec "/Users/redacted/Library/Caches/VisualStudio/17.0/MSBuild/36265_3/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/../../tools/netcoreapp3.0/rzc.dll" generate
    -s
    /Users/redacted/Developer/repositories/bcee/Toolkit/RedactedCompany.Toolkit.Platform.Web/_Imports.razor
    -r
    _Imports.razor
    -o
    /Users/redacted/Developer/repositories/bcee/Toolkit/RedactedCompany.Toolkit.Platform.Web/obj/Debug/netstandard2.1/RazorDeclaration/_Imports.razor.g.cs
    -k
    component
    -p
    /Users/redacted/Developer/repositories/bcee/Toolkit/RedactedCompany.Toolkit.Platform.Web
    -t
    obj/Debug/netstandard2.1/RedactedCompany.Toolkit.Platform.Web.RazorComponents.declaration.json
    -v
    3.0
    -c
    Default
    --root-namespace
    RedactedCompany.Toolkit.Web
    --csharp-language-version
    8.0
    --generate-declaration
    
    The application to execute does not exist: '/Users/redacted/Library/Caches/VisualStudio/17.0/MSBuild/36265_3/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/../../tools/netcoreapp3.0/rzc.dll'
    /Users/redacted/Library/Caches/VisualStudio/17.0/MSBuild/36265_3/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Component.targets(106,5): error : rzc generate exited with code 129.
Done building target "RazorGenerateComponentDeclaration" in project "RedactedCompany.Toolkit.Platform.Web.csproj" -- FAILED.

Done building project "RedactedCompany.Toolkit.Platform.Web.csproj" -- FAILED.

Build FAILED.

The interesting line is: The application to execute does not exist: '/Users/redacted/Library/Caches/VisualStudio/17.0/MSBuild/36265_3/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/../../tools/netcoreapp3.0/rzc.dll'

I can confirm the file does not exist. And if I look into the Razor SDK it does not contain the rzc.dll at all.

➜  ~ ls -al /Users/redacted/Library/Caches/VisualStudio/17.0/MSBuild/36265_3/Sdks/Microsoft.NET.Sdk.Razor/
total 16
drwxr-xr-x@  9 florian  staff   288 Jan 24 17:50 .
drwxr-xr-x@ 12 florian  staff   384 Jan 24 17:50 ..
-rwxr--r--@  1 florian  staff  7006 Jan 12 18:32 Icon.png
drwxr-xr-x@  5 florian  staff   160 Jan 24 17:50 Sdk
drwxr-xr-x@  3 florian  staff    96 Jan 24 17:50 build
drwxr-xr-x@  4 florian  staff   128 Jan 24 17:50 buildMultiTargeting
drwxr-xr-x@  3 florian  staff    96 Jan 24 17:50 extensions
drwxr-xr-x@  3 florian  staff    96 Jan 24 17:50 lib
drwxr-xr-x@  3 florian  staff    96 Jan 24 17:50 tasks
➜  ~ find /Users/redacted/Library/Caches/VisualStudio/17.0/MSBuild/36265_3/Sdks/Microsoft.NET.Sdk.Razor/ -name 'rzc.dll'
# nothing

The Razor csproj file looks like this:

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

  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
    <RazorLangVersion>3.0</RazorLangVersion>
    <PackageId>RedactedCompany.Toolkit.Web</PackageId>
    <PackageVersion>0.0.0</PackageVersion>
    <Authors>RedactedCompany</Authors>
    <Description>Web implementations of architectural guidelines</Description>
    <Copyright>2020</Copyright>
    <NeutralLanguage>en</NeutralLanguage>
    <Owners>RedactedCompany</Owners>
    <Summary>Web implementations of architectural guidelines</Summary>
    <PackageTags>dotnet,architecture,toolkit,web</PackageTags>
    <Title>Toolkit.Platform Web</Title>
    <RootNamespace>RedactedCompany.Toolkit.Web</RootNamespace>
    <ReleaseVersion>0.0.0</ReleaseVersion>
  </PropertyGroup>


  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.9" />
    <PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.9" />
    <PackageReference Include="NuGet.Build.Packaging" Version="0.2.2">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="RedactedCompany.Toolkit.Architecture" Version="1.3.2-alpha" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Infrastructure\" />
  </ItemGroup>
</Project>

If I create a new class library the csproj looks like this:

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

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>


  <ItemGroup>
    <SupportedPlatform Include="browser" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.2" />
  </ItemGroup>

</Project>

And of course it builds.

I am no expert with the whole .NET ecosystem so I am kind of lost.
Should I try to migrate from netstandard2.1 to net7.0? I think I've read that .NET 7 should be compatible with netstandard2.1.

Can I still build that kind of project with the latest version of Visual Studio?
Do you know why the rzc.dll is not there?

0

There are 0 best solutions below