Aspnetcore: Blazor: Mono linker path not properly quoted

Created on 10 Dec 2019  路  9Comments  路  Source: dotnet/aspnetcore

Describe the bug

The new BlazorILLink task does not properly quote the MonoLinkerPath, so usernames with e.g. spaces make the linker task fail.
See: https://github.com/aspnet/AspNetCore/blob/master/src/Components/Blazor/Build/src/targets/Blazor.MonoRuntime.targets#L204

To Reproduce

Try to compile a blazor wasm project from a machine with a space in the username. See this gist, at "_LinkBlazorApplication":

https://gist.githubusercontent.com/TofuEcho/0d110f8cad83071406dcd8f48d928fbc/raw/259d63b7e9b541cdc17475b142fa8c7a7e537a62/gistfile1.txt

Further technical details

  • ASP.NET Core version 3.1.0
Done area-blazor blazor-wasm bug

Most helpful comment

@Flearz workaround is to edit the file ".nuget\packages\microsoft.aspnetcore.blazor.build\3.1.0-preview4.19579.2\targets\Blazor.MonoRuntime.targets" in your home directory and change:

  <BlazorILLink
        ILLinkPath="$(MonoLinkerPath)"
        AssemblyPaths="@(_BlazorAssemblyToLink)"
        RootAssemblyNames="@(_BlazorLinkerRoot)"
        RootDescriptorFiles="@(BlazorLinkerDescriptor)"
        OutputDirectory="$(BlazorIntermediateLinkerOutputPath)"
        ExtraArgs="$(_BlazorLinkerAdditionalOptions)"
        ToolExe="$(_DotNetHostFileName)"
        ToolPath="$(_DotNetHostDirectory)" />

into

  <BlazorILLink
        ILLinkPath="&quot;$(MonoLinkerPath)&quot;"
        AssemblyPaths="@(_BlazorAssemblyToLink)"
        RootAssemblyNames="@(_BlazorLinkerRoot)"
        RootDescriptorFiles="@(BlazorLinkerDescriptor)"
        OutputDirectory="$(BlazorIntermediateLinkerOutputPath)"
        ExtraArgs="$(_BlazorLinkerAdditionalOptions)"
        ToolExe="$(_DotNetHostFileName)"
        ToolPath="$(_DotNetHostDirectory)" />

All 9 comments

Got the same problem, "ILLink failed with exited code 1" even with a blank project...

@Flearz workaround is to edit the file ".nuget\packages\microsoft.aspnetcore.blazor.build\3.1.0-preview4.19579.2\targets\Blazor.MonoRuntime.targets" in your home directory and change:

  <BlazorILLink
        ILLinkPath="$(MonoLinkerPath)"
        AssemblyPaths="@(_BlazorAssemblyToLink)"
        RootAssemblyNames="@(_BlazorLinkerRoot)"
        RootDescriptorFiles="@(BlazorLinkerDescriptor)"
        OutputDirectory="$(BlazorIntermediateLinkerOutputPath)"
        ExtraArgs="$(_BlazorLinkerAdditionalOptions)"
        ToolExe="$(_DotNetHostFileName)"
        ToolPath="$(_DotNetHostDirectory)" />

into

  <BlazorILLink
        ILLinkPath="&quot;$(MonoLinkerPath)&quot;"
        AssemblyPaths="@(_BlazorAssemblyToLink)"
        RootAssemblyNames="@(_BlazorLinkerRoot)"
        RootDescriptorFiles="@(BlazorLinkerDescriptor)"
        OutputDirectory="$(BlazorIntermediateLinkerOutputPath)"
        ExtraArgs="$(_BlazorLinkerAdditionalOptions)"
        ToolExe="$(_DotNetHostFileName)"
        ToolPath="$(_DotNetHostDirectory)" />

@jspuij
This works thank you so much, I've been stuck with this for hours. Hope they will correct this soon.
Have a nice week.
Rihen

P.S. Even though I put the project in my SSD root, it was not working

@Flearz You're welcome ;-)
The fact that it was not working is that the linker is started from the nuget package folder, which resides in the users home directory. Project location is not relevant in this case.

@jspuij thanks for contacting us.

We'll take a look at the issue and get back to you.

I'm seeing the same issue.

This works thank you so much, I've been stuck with this for hours. Hope they will correct this soon.

@Flearz Glad it was hours only for you. Days for me :)

EDIT: The workaround is awesome. Thanks to @jspuij.

Same issue here. Spent an evening tracking this down before finding this post. Can confirm that the workaround worked. Thanks!

@jspuij thank you so much, how can you be that rocking smart?

@jkotalik Nice :)

Was this page helpful?
0 / 5 - 0 ratings