生成和运行时dotnet新的blazor错误

时间:2019-03-11 14:23:09

标签: c# powershell visual-studio-code .net-core blazor

我有dotnet-sdk-3.0.100-preview3-010431-win-x64个zip二进制文件,并将其提取到C:\dotnet中,并将此路径添加到用户变量路径中。 我以前在该路径中安装过dotnet 2.2,然后删除了它并粘贴了新版本(preview3-010431)以创建一个blazor项目。

dotnet可以正确创建和运行webapp项目,但不能运行。 首先,我执行了以下命令:

dotnet new -i Microsoft.AspNetCore.Blazor.Templates::0.9.0-preview3-19154-02

当我跑步时:

dotnet new blazor -o WebApplication1
cd WebApplication1

没关系。但是dotnet build不起作用,我得到了错误消息:

  

“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.blazor.build \ 0.9.0-preview3-19154-02 \ targets \ Blazor.MonoRuntime.targets(439,5):   错误MSB3073:命令“ dotnet   “ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.blazor.mono \ 0.8.0-preview-20190204.1 \ build \ netstandard1.0 ../../ tools / illink / illink.dll “ -l none --verbose --strip-security true --exclude-feature com --exclude-feature sre -v false -c link -u link -b true -d” C:\ Users \ sap-komaei.CII .nu​​get \ packages \ microsoft.aspnetcore.blazor.mono \ 0.8.0-preview-20190204.1 \ build \ netstandard1.0 ../../ tools / mono / bcl /“   -d“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.blazor.mono \ 0.8.0-preview-20190204.1 \ build \ netstandard1.0 ../../ tools / mono / bcl / Facades /“ -o” E:\ Projects \ WebApplication1 \ obj \ Debug \ netstandard2.0 \ blazor \ linker /“   -x“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.blazor.build \ 0.9.0-preview3-19154-02 \ targets \ BuiltInBclLinkerDescriptor.xml”   -x“ E:\ Projects \ WebApplication1 \ obj \ Debug \ netstandard2.0 \ blazor \ linker.descriptor.xml”   -a“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.blazor \ 0.9.0-preview3-19154-02 \ lib \ netstandard2.0 \ Microsoft.AspNetCore.Blazor.dll” -a “ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.components \ 3.0.0-preview3-19153-02 \ lib \ netstandard2.0 \ Microsoft.AspNetCore.Components.dll”   -a“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.components.browser \ 3.0.0-preview3-19153-02 \ lib \ netstandard2.0 \ Microsoft.AspNetCore.Components.Browser。 dll”   -a“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.extensions.dependencyinjection \ 3.0.0-preview3.19153.1 \ lib \ netstandard2.0 \ Microsoft.Extensions.DependencyInjection.dll” -a“ C :\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.extensions.dependencyinjection.abstractions \ 3.0.0-preview3.19153.1 \ lib \ netstandard2.0 \ Microsoft.Extensions.DependencyInjection.Abstractions.dll“   -a“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.jsinterop \ 3.0.0-preview3.19153.1 \ lib \ netstandard2.0 \ Microsoft.JSInterop.dll”   -a“ C:\ Users \ sap-komaei.CII.nuget \ packages \ mono.webassembly.interop \ 3.0.0-preview3.19153.1 \ lib \ netstandard2.0 \ Mono.WebAssembly.Interop.dll”   -a“ C:\ Users \ sap-komaei.CII.nuget \ packages \ system.componentmodel.annotations \ 4.6.0-preview3.19128.7 \ lib \ netstandard2.0 \ System.ComponentModel.Annotations.dll”   -a“ E:\ Projects \ WebApplication1 \ obj \ Debug \ netstandard2.0 \ WebApplication1.dll”“   退出,代码为-2147450730。   [E:\ Projects \ WebApplication1 \ WebApplication1.csproj]

     

构建失败。

     

C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.blazor.build \ 0.9.0-preview3-19154-02 \ targets \ Blazor.MonoRuntime.targets(439,5):   错误MSB3073:命令“ dotnet   “ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.blazor.mono \ 0.8.0-preview-20190204.1 \ build \ netstandard1.0 ../../ tools / illink / illink.dll “ -l none --verbose --strip-security true --exclude-feature com --exclude-feature sre -v false -c link -u link -b true -d” C:\ Users \ sap-komaei.CII .nu​​get \ packages \ microsoft.aspnetcore.blazor.mono \ 0.8.0-preview-20190204.1 \ build \ netstandard1.0 ../../ tools / mono / bcl /“   -d“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.blazor.mono \ 0.8.0-preview-20190204.1 \ build \ netstandard1.0 ../../ tools / mono / bcl / Facades /“ -o” E:\ Projects \ WebApplication1 \ obj \ Debug \ netstandard2.0 \ blazor \ linker /“   -x“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.blazor.build \ 0.9.0-preview3-19154-02 \ targets \ BuiltInBclLinkerDescriptor.xml”   -x“ E:\ Projects \ WebApplication1 \ obj \ Debug \ netstandard2.0 \ blazor \ linker.descriptor.xml”   -a“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.blazor \ 0.9.0-preview3-19154-02 \ lib \ netstandard2.0 \ Microsoft.AspNetCore.Blazor.dll” -a “ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.components \ 3.0.0-preview3-19153-02 \ lib \ netstandard2.0 \ Microsoft.AspNetCore.Components.dll”   -a“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.components.browser \ 3.0.0-preview3-19153-02 \ lib \ netstandard2.0 \ Microsoft.AspNetCore.Components.Browser。 dll”   -a“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.extensions.dependencyinjection \ 3.0.0-preview3.19153.1 \ lib \ netstandard2.0 \ Microsoft.Extensions.DependencyInjection.dll” -a“ C :\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.extensions.dependencyinjection.abstractions \ 3.0.0-preview3.19153.1 \ lib \ netstandard2.0 \ Microsoft.Extensions.DependencyInjection.Abstractions.dll“   -a“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.jsinterop \ 3.0.0-preview3.19153.1 \ lib \ netstandard2.0 \ Microsoft.JSInterop.dll”   -a“ C:\ Users \ sap-komaei.CII.nuget \ packages \ mono.webassembly.interop \ 3.0.0-preview3.19153.1 \ lib \ netstandard2.0 \ Mono.WebAssembly.Interop.dll”   -a“ C:\ Users \ sap-komaei.CII.nuget \ packages \ system.componentmodel.annotations \ 4.6.0-preview3.19128.7 \ lib \ netstandard2.0 \ System.ComponentModel.Annotations.dll”   -a“ E:\ Projects \ WebApplication1 \ obj \ Debug \ netstandard2.0 \ WebApplication1.dll”“   退出,代码为-2147450730。   [E:\ Projects \ WebApplication1 \ WebApplication1.csproj] 0警告1   错误”

我删除了C:\ Users \ sap-komaei.CII.nuget \ packages中的所有软件包,但是存在错误。我也删除了C:\ Users \ sap-komaei.CII.dotnet中的所有文件和文件夹,但是存在错误。

我跑步后:

dotnet new -i Microsoft.AspNetCore.Blazor.Templates

然后构建,我得到这个错误:

  

“ C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.blazor.build \ 0.7.0 \ targets \ RazorCompilation.targets(184,5):   错误:rzc生成已退出,代码为-2147450730。   [E:\ Projects \ WebApplication1 \ WebApplication1.csproj]

     

构建失败。

     

C:\ Users \ sap-komaei.CII.nuget \ packages \ microsoft.aspnetcore.blazor.build \ 0.7.0 \ targets \ RazorCompilation.targets(184,5):   错误:rzc生成已退出,代码为-2147450730。   [E:\ Projects \ WebApplication1 \ WebApplication1.csproj] 0警告1   错误”

1 个答案:

答案 0 :(得分:0)

我想通了。

要构建blazor模板,我们必须同时安装dotnet core v3预览版和最新的2.2版本。我无法在工作电脑上安装任何应用程序。所以我使用便携式版本。

对我来说的解决方法

  1. 将E:\ My Pro \ DotNetCore \ dotnet-sdk-2.2.105-win-x64 \ sdk \ 2.2.105文件夹复制到我的安装SDK路径(E:\ dotnet \ sdk)

  2. 将E:\ My Pro \ DotNetCore \ dotnet-sdk-2.2.105-win-x64 \ shared \ Microsoft.NETCore.App \ 2.2.3文件夹复制到E:\ dotnet \ shared \ Microsoft.NETCore .app。

  3. 将E:\ dotnet \和E:\ dotnet \ host \ fxr \ 3.0.0-preview3-27503-5 \和E:\ My Pro \ VS Code \ 1.32.1 \添加到用户路径变量

  4. 将E:\ dotnet \添加到DOTNET_ROOT变量中。