Skip to content

Mono.Cecil.AssemblyResolutionException because of typo in assembly name #5673

@NinjaSciurus

Description

@NinjaSciurus

I am trying to build (Ctrl + F5) on Windows 7 with VS2017 using the following Blazor Nuget Packages:

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.AspNetCore.Blazor.Cli" Version="0.7.0" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Blazor" Version="0.7.0" />
    <PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.7.0" />
    <PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.7.0" />
  </ItemGroup>

The BlazorLinkOnBuild property in the csproj file is set to true:

<BlazorLinkOnBuild>true</BlazorLinkOnBuild>

The build fails with

Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'C:\Users\XXX\.nuget\packages\microsoft.extensions.logging.configration\2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Configuration.dll

Note the typo in the assembly folder name: it says "configration" instead of "configuration" in the path (missing 'u'). The strange thing is, I've seen the same message with another version of that typo, where it was "cofiguration" (missing 'n'). I've checked, the misspelled folder does not exist, the correctly spelled one does.

The full call stack is

Fatal error in IL Linker
Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'C:\Users\XXX\.nuget\packages\microsoft.extensions.logging.configration\2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Configuration.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'C:\Users\XXX\.nuget\packages\microsoft.extensions.logging.configration\2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Configuration.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
   at Mono.Linker.DirectoryAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
   at Mono.Linker.AssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
   at Mono.Linker.LinkContext.Resolve(IMetadataScope scope)
   at Mono.Linker.LinkContext.Resolve(IMetadataScope scope)
   at Mono.Linker.LinkContext.Resolve(String name)
   at Mono.Linker.Steps.ResolveFromAssemblyStep.Process()
   at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at Mono.Linker.Driver.Run(ILogger customLogger)
   at Mono.Linker.Driver.Execute(String[] args, ILogger customLogger)

Even more strange, a second attempt to build succeeds but fails at runtime with

Unhandled Exception: System.ArgumentException: The directory name '[output dir]\bin\Debug\netstandard2.0\dist\' does not exist.
Parameter name: path
   at System.IO.FileSystemWatcher..ctor(String path, String filter)
   at System.IO.FileSystemWatcher..ctor(String path)
   at Microsoft.Extensions.FileProviders.PhysicalFileProvider.CreateFileWatcher(String root, ExclusionFilters filters)
   at Microsoft.AspNetCore.Builder.BlazorApplicationBuilderExtensions.UseBlazor(IApplicationBuilder app, BlazorOptions options)
   at Microsoft.AspNetCore.Blazor.Cli.Server.Startup.Configure(IApplicationBuilder app, IConfiguration configuration)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String shutdownMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Command(String name, Action`1 configuration, Boolean throwOnUnexpectedArg)
   at Microsoft.AspNetCore.Blazor.Cli.Program.Main(String[] args)

I can only get it to work using

<BlazorLinkOnBuild>false</BlazorLinkOnBuild>

but that pushes out the assemblies in their unmodified size (a total of 14.5 MB).

I am stumped, what am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalThis is an issue in a component not contained in this repository. It is open for tracking purposes.area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions