Skip to content

After upgrading to .NET Standard 2.1 and Blazor v3.1.0-preview4.19579.2, Blazor WebAssembly projects no longer work. #17619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Rauce opened this issue Dec 5, 2019 · 16 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly ✔️ Resolution: Duplicate Resolved as a duplicate of another issue investigate

Comments

@Rauce
Copy link

Rauce commented Dec 5, 2019

To rule out any project-specific issues, I followed the instructions at https://docs.microsoft.com/en-us/aspnet/core/blazor/get-started?view=aspnetcore-3.1&tabs=visual-studio to create a new clean Blazor WebAssembly project.

I can confirm the new project is created targeting .NET Standard 2.1, with Nuget Blazor package versions v3.1.0-preview4.19579.2.

After the project is created, without modifying any of the project files, I simply hit 'Start Debugging' in Visual Studio (2019 v16.4).

In the first build attempt I get the following single error:

Code: <blank>
Description: ILLink failed with exited code 1
Project: BlazorApp1
File: Blazor.MonoRuntime.targets
Line: 201

If I then immediately immediately try 'Start Debugging' again, it builds without this error, but in the launched browser window the following error appears instead:

An error occurred while starting the application.
System.IO.DirectoryNotFoundException: C:\Users\<My Name>\source\repos\BlazorApp1\BlazorApp1\bin\Debug\netstandard2.1\dist\
   at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
   at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root)
   at Microsoft.AspNetCore.Builder.BlazorHostingApplicationBuilderExtensions.UseClientSideBlazorFiles(IApplicationBuilder app, String clientAssemblyFilePath)
   at Microsoft.AspNetCore.Blazor.DevServer.Server.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment environment, IConfiguration configuration)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__2(IApplicationBuilder app)
   at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>c__DisplayClass4_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)

If I revert this project back to .NET Standard 2.0 and Blazor v3.1.0-preview3.19555.2, it builds and runs without any issues.

Here's the output of dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   3.1.100
 Commit:    cd82f021f4

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.100\

Host (useful for support):
  Version: 3.1.0
  Commit:  65f04fb6db

.NET Core SDKs installed:
  2.1.602 [C:\Program Files\dotnet\sdk]
  2.1.801 [C:\Program Files\dotnet\sdk]
  2.1.802 [C:\Program Files\dotnet\sdk]
  2.2.202 [C:\Program Files\dotnet\sdk]
  2.2.401 [C:\Program Files\dotnet\sdk]
  2.2.402 [C:\Program Files\dotnet\sdk]
  3.0.100-preview8-013656 [C:\Program Files\dotnet\sdk]
  3.0.100-rc1-014190 [C:\Program Files\dotnet\sdk]
  3.0.100 [C:\Program Files\dotnet\sdk]
  3.1.100 [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.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.7 [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.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.14 [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 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview8.19405.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-rc1.19457.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.0 [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.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.14 [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 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-rc1-19456-20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.0.0-rc1-19456-20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Any ideas?

@mkArtakMSFT mkArtakMSFT added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly labels Dec 5, 2019
@simonpbond
Copy link

simonpbond commented Dec 5, 2019

@javiercn
Also having the same issue, upgrading a 3.0 to 3.1 Blazor WebAssembly (Preview 4).

5>Could not execute because the specified command or file was not found. 5>Possible reasons for this include: 5> * You misspelled a built-in dotnet command. 5> * You intended to execute a .NET Core program, but dotnet-C:\Users\Simon does not exist. 5> * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH. 5>C:\Users\Simon Bond\.nuget\packages\microsoft.aspnetcore.blazor.build\3.1.0-preview4.19579.2\targets\Blazor.MonoRuntime.targets(204,5): error : ILLink failed with exited code 1.

@javiercn
Copy link
Member

javiercn commented Dec 5, 2019

@Rauce thanks for contacting us.

I'm not sure what can be going on. I would suggest you first try to update to the latest released blazor version, which is preview4 and is built on top of the .NET Core 3.1.0 RTM

@Rauce
Copy link
Author

Rauce commented Dec 5, 2019

@javiercn

I can confirm the new project I tested with is created targeting .NET Standard 2.1, with Nuget Blazor package versions v3.1.0-preview4.19579.2.

.NET Core 3.1.0 RTM is installed.

@javiercn
Copy link
Member

javiercn commented Dec 5, 2019

@pranavkm Based on this, this seems to be missing the application name, is that correct?
C:\Users\<My Name>\source\repos\BlazorApp1\BlazorApp1\bin\Debug\netstandard2.1\dist\

@Rauce
Copy link
Author

Rauce commented Dec 5, 2019

FYI.

If I revert my projects back to .NET Standard 2.0 and Blazor v3.1.0-preview3.19555.2 (while keeping VS2019 16.4.0 and .NET Core 3.1.0 RTM), they build and run without any issues. (I added this to original issue description).

@simonpbond
Copy link

simonpbond commented Dec 5, 2019

I think you can reproduce this by creating a new Blazor WebAssembly (ASP.NET Core Hosted) project (VS16.4, Latest Templates), via the VS UI, and try to rebuild the default generated Client project.

@Rauce Rauce changed the title After upgrading to VS2019 16.4 and .NET Core 3.1, Blazor WebAssembly projects no longer work. After upgrading to .NET Standard 2.1 and Blazor v3.1.0-preview4.19579.2, Blazor WebAssembly projects no longer work. Dec 5, 2019
@mkArtakMSFT mkArtakMSFT added this to the blazor-wasm-preview5 milestone Dec 5, 2019
@GerritBergen
Copy link

Having issues too. Anyone got a workaround?

@GerritBergen
Copy link

GerritBergen commented Dec 6, 2019

Disabling linking on build seems to let me build right now.

  <PropertyGroup>
    <BlazorLinkOnBuild>false</BlazorLinkOnBuild>
  </PropertyGroup>

@pranavkm
Copy link
Contributor

pranavkm commented Dec 9, 2019

Could one of you share a minimal project that reproduces the build error? I tried @simonpbond's suggestion

I think you can reproduce this by creating a new Blazor WebAssembly (ASP.NET Core Hosted) project (VS16.4, Latest Templates), via the VS UI, and try to rebuild the default generated Client project.

and haven't been able to reproduce the error.

@simonpbond
Copy link

simonpbond commented Dec 9, 2019

@pranavkm Reproduced project
I try to rebuild the .Client project, it actually built on first try, then on second and third try it failed with IL Link error. This is just the default VS generated project as mentioned above.

ILLink failed with exited code 1.

@pranavkm
Copy link
Contributor

pranavkm commented Dec 9, 2019

Thanks!

@pranavkm
Copy link
Contributor

Still no luck. I tried running rebuild a couple of times on the BlazorRequestedRepo.Client project, tried rebuilding with changes to file and regular builds. All of these succeeded. Is there a specific sequence you're running? Here are a couple of things that would help

  • Could you grab the build logs from VS when this happens? To do this, you'll need to install this extension: https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.ProjectSystemTools. Once installed go to View > Other Windows > Build Logging and click on the ▶️ button (Start build logging). Attach the one from the failing build to this issue.

  • Can you look at the Output window and see if it includes any additional content as to why the task failed?

@pranavkm pranavkm added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Dec 10, 2019
@jspuij
Copy link
Contributor

jspuij commented Dec 11, 2019

Possibly the same one as this one:
#17754

@simonpbond
Copy link

simonpbond commented Dec 11, 2019

Possibly the same one as this one:
#17754

@jspuij @pranavkm Can confirm this has solved the issue for me, thank you.

@Rauce
Copy link
Author

Rauce commented Dec 11, 2019

Woohoo!

@jspuij's solution in #17754 (#17754 (comment)) fixed this error - my project is working again.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Dec 11, 2019
@pranavkm
Copy link
Contributor

We'll use the other to track fixing this for the next release.

@pranavkm pranavkm added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Dec 11, 2019
@ghost ghost added the Status: Resolved label Dec 11, 2019
@pranavkm pranavkm removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. Status: Resolved labels Dec 11, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Jan 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly ✔️ Resolution: Duplicate Resolved as a duplicate of another issue investigate
Projects
None yet
Development

No branches or pull requests

7 participants