【问题标题】:How to resolve "error : rzc discover exited with code 150"如何解决“错误:rzc discover exited with code 150”
【发布时间】:2020-05-31 23:29:39
【问题描述】:

我的 dotnet SDK 版本是 3.0.100。我正在尝试在 macOS 中运行一个用 dotnet 核心框架包装的 Angular Web 应用程序。但是每当我尝试构建项目时,都会出现以下错误。

/Users/juthisarker/.nuget/packages/microsoft.aspnetcore.razor.design/2.2.0/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(80,5): error : rzc discover exited with code 150. [/Users/juthisarker/Documents/webTest/testtwo/testtwo.csproj]

The build failed. Fix the build errors and run again.

起初,我的 dotnet SDK 版本是 3.1.1。然后,我将我的 dotnet SDK 版本降级到 3.0.100。我认为它将解决框架的剃刀设计问题。但是,它并没有解决问题。我这里也给出了 testtwo.csproj 文件。

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
    <TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
    <IsPackable>false</IsPackable>
    <SpaRoot>ClientApp\</SpaRoot>
    <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>

    <!-- Set this to true if you enable server-side prerendering -->
    <BuildServerSideRenderer>false</BuildServerSideRenderer>
    <RootNamespace>truck_tracking</RootNamespace>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App"/>
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
     <!-- <PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="2.2.0" />
     <PackageReference Include="Microsoft.Extensions.Identity.Core" Version="2.2.0" />
     <PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.2.0" /> -->
  </ItemGroup>

  <ItemGroup>
    <!-- Don't publish the SPA source files, but do show them in the project files list -->
    <Content Remove="$(SpaRoot)**" />
    <None Remove="$(SpaRoot)**" />
    <None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
  </ItemGroup>

  <Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
    <!-- Ensure Node.js is installed -->
    <Exec Command="node --version" ContinueOnError="true">
      <Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
    </Exec>
    <Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
    <Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
    <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
  </Target>

  <Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
    <!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
    <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
    <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --prod" />
    <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />

    <!-- Include the newly-built files in the publish output -->
    <ItemGroup>
      <DistFiles Include="$(SpaRoot)dist\**; $(SpaRoot)dist-server\**" />
      <DistFiles Include="$(SpaRoot)node_modules\**" Condition="'$(BuildServerSideRenderer)' == 'true'" />
      <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
        <RelativePath>%(DistFiles.Identity)</RelativePath>
        <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
      </ResolvedFileToPublish>
    </ItemGroup>
  </Target>

</Project>

【问题讨论】:

  • 你能给我们看看你的/Users/juthisarker/Documents/webTest/testtwo/testtwo.csproj文件吗?
  • @vasily.sib,是的!我已经编辑了我的帖子并提供了 testtwo.csproj 文件。
  • 我可能错了,但这个.csproj 文件看起来像netcoreapp2.2,不是3.1 也不是3.0?
  • 我也遇到了同样的问题。有人找到解决方案了吗?
  • @LetieTechera,我下载了 .dotnet core 2.2 版作为解决我的问题的项目要求。

标签: c# angular .net-core


【解决方案1】:

我认为这是因为某些项目引用了需要 .Net Core 2.x 版本的包。

在 CentOS 7 上,我已将 2.1 与 3.1 并行安装,现在一切正常:

yum install dotnet-sdk-2.1

或者(也许最好)你可以设置环境变量:

export DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2

【讨论】:

  • 这帮了大忙!谢谢。
猜你喜欢
  • 2021-03-08
  • 2019-09-25
  • 1970-01-01
  • 1970-01-01
  • 2015-10-03
  • 1970-01-01
  • 1970-01-01
  • 2021-05-17
  • 2021-05-08
相关资源
最近更新 更多