dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.49k stars 10.04k forks source link

Problem with Mono or IL Linker #6639

Closed tezzly closed 5 years ago

tezzly commented 5 years ago

Describe the bug

I'm unable to run Blazor - blazorhosted application (as a whole)

I'm unable to compile Blazor.Client side.

Firstly - this error occured

Severity    Code    Description Project File    Line    Suppression State
Error   MSB3073 The command "dotnet "C:\Admins\Admin\.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\targets\../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:\Admins\Admin\.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\targets\../tools/mono/bcl/" -d "C:\Admins\Admin\.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\targets\../tools
/mono/bcl/Facades/" -o "C:\Repo\Project\Blazor\Blazor.Client\obj\Debug\netstandard2.0\blazor\linker/" -x 
"C:\Admins\Admin\.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\targets\BuiltInBclLinkerDescriptor.xml" 
-x "C:\Repo\Project\Blazor\Blazor.Client\obj\Debug\netstandard2.0\blazor\linker.descriptor.xml" -a 
"C:\Admins\Admin\.nuget\packages\microsoft.aspnetcore.blazor\0.7.0\lib\netstandard2.0
\Microsoft.AspNetCore.Blazor.dll" -a "C:\Admins\Admin\.nuget\packages\microsoft.aspnetcore.blazor.browser\0.7.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.Browser.dll" -a "C:\Admins\Admin\.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\lib\netstandard1.0\Microsoft.AspNetCore.Blazor.TagHelperWorkaround.dll" -a "C:\Admins\Admin\.nuget\packages\microsoft.extensions.dependencyinjection\2.1.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll" -a "C:\Admins\Admin\.nuget\packages\microsoft.extensions.dependencyinjection.abstractions\2.1.0\lib\netstandard2.0
\Microsoft.Extensions.DependencyInjection.Abstractions.dll" -a "C:\Admins\Admin\.nuget\packages
\microsoft.jsinterop\0.7.0\lib\netstandard2.0\Microsoft.JSInterop.dll" -a "C:\Admins\Admin\.nuget
\packages\mono.webassembly.interop\0.7.0\lib\netstandard2.0\Mono.WebAssembly.Interop.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.componentmodel.annotations\4.5.0
\lib\netstandard2.0\System.ComponentModel.Annotations.dll" -a "C:\Repo\Project\Blazor\Blazor.Shared
\bin\Debug\netstandard2.0\Blazor.Shared.dll" -a "C:\Repo\Project\Blazor\Blazor.Shared\bin\Debug\netstandard2.0\Microsoft.AspNetCore.Http.Features.dll" -a "C:\Repo\Project\Blazor\Blazor.Client
\obj\Debug\netstandard2.0\Blazor.Client.dll"" exited with code 1.   Blazor.Client   C:\Admins\Admin\.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\targets\Blazor.MonoRuntime.targets  439 

Then:

Exception thrown: 'System.ArgumentException' in System.IO.FileSystem.Watcher.dll
An exception of type 'System.ArgumentException' occurred in System.IO.FileSystem.Watcher.dll but was not handled in user code

System.ArgumentException: 'The directory name 'C:\Repo\Project\Blazor\Blazor.Client\bin\Debug\netstandard2.0\dist\' does not exist.'

When trying to compile just Client side

1>------ Rebuild All started: Project: Blazor.Shared, Configuration: Debug Any CPU ------
1>C:\Program Files\dotnet\sdk\2.1.600-preview-009426\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(143,5): message NETSDK1057: You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452
1>Blazor.Shared -> C:\Repo\Project\Blazor\Blazor.Shared\bin\Debug\netstandard2.0\Blazor.Shared.dll
2>------ Rebuild All started: Project: Blazor.Client, Configuration: Debug Any CPU ------
2>Blazor.Client -> C:\Repo\Project\Blazor\Blazor.Client\bin\Debug\netstandard2.0\Blazor.Client.dll
2>Fatal error in IL Linker
2>Mono.Linker.LoadException: Error while processing references of 'Blazor.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Linker.LoadException: Error while processing references of 'Blazor.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Extensions.Primitives, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Extensions.Primitives, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
2>   at Mono.Linker.DirectoryAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
2>   at Mono.Linker.AssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
2>   at Mono.Linker.LinkContext.Resolve(IMetadataScope scope)
2>   --- End of inner exception stack trace ---
2>   at Mono.Linker.LinkContext.Resolve(IMetadataScope scope)
2>   at Mono.Linker.LinkContext.ResolveReferences(AssemblyDefinition assembly)
2>   at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences(AssemblyDefinition assembly)
2>   at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences(AssemblyDefinition assembly)
2>   --- End of inner exception stack trace ---
2>   at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences(AssemblyDefinition assembly)
2>   at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences(AssemblyDefinition assembly)
2>   --- End of inner exception stack trace ---
2>   at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences(AssemblyDefinition assembly)
2>   at Mono.Linker.Steps.LoadReferencesStep.ProcessAssembly(AssemblyDefinition assembly)
2>   at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
2>   at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
2>   at Mono.Linker.Pipeline.Process(LinkContext context)
2>   at Mono.Linker.Driver.Run(ILogger customLogger)
2>   at Mono.Linker.Driver.Execute(String[] args, ILogger customLogger)
2>C:\Users\Admin\.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\targets\Blazor.MonoRuntime.targets(439,5): error MSB3073: The command "dotnet "C:\Users\User\.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\targets\../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\User\.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\targets\../tools/mono/bcl/" -d "C:\Users\User\.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\targets\../tools/mono/bcl/Facades/" -o "C:\Repo\Project\Blazor\Blazor.Client\obj\Debug\netstandard2.0\blazor\linker/" -x "C:\Users\User\.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\targets\BuiltInBclLinkerDescriptor.xml" -x "C:\Repo\Project\Blazor\Blazor.Client\obj\Debug\netstandard2.0\blazor\linker.descriptor.xml" -a "C:\Users\User\.nuget\packages\microsoft.aspnetcore.blazor\0.7.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.dll" -a "C:\Users\User\.nuget\packages\microsoft.aspnetcore.blazor.browser\0.7.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.Browser.dll" -a "C:\Users\User\.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\lib\netstandard1.0\Microsoft.AspNetCore.Blazor.TagHelperWorkaround.dll" -a "C:\Users\User\.nuget\packages\microsoft.extensions.dependencyinjection\2.1.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll" -a "C:\Users\User\.nuget\packages\microsoft.extensions.dependencyinjection.abstractions\2.1.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" -a "C:\Users\User\.nuget\packages\microsoft.jsinterop\0.7.0\lib\netstandard2.0\Microsoft.JSInterop.dll" -a "C:\Users\User\.nuget\packages\mono.webassembly.interop\0.7.0\lib\netstandard2.0\Mono.WebAssembly.Interop.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.componentmodel.annotations\4.5.0\lib\netstandard2.0\System.ComponentModel.Annotations.dll" -a "C:\Repo\Project\Blazor\Blazor.Shared\bin\Debug\netstandard2.0\Blazor.Shared.dll" -a "C:\Repo\Project\Blazor\Blazor.Shared\bin\Debug\netstandard2.0\Microsoft.AspNetCore.Http.Features.dll" -a "C:\Repo\Project\Blazor\Blazor.Client\obj\Debug\netstandard2.0\Blazor.Client.dll"" exited with code 1.
2>Done building project "Blazor.Client.csproj" -- FAILED.
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

After double clicking this error it opens:

Blazor.MonoRuntime.targets

in

C:\Users\Admin.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\targets

and points on this line:

<!--` Run the linker and put the results in /obj/<<configuration>>/<<targetframework>>/blazor/blazor/linker -->
    <Exec Command="dotnet &quot;$(MonoLinkerPath)&quot; $(_BlazorLinkerAdditionalOptions) @(_BlazorFolderLookupPaths, ' ') -o &quot;$(BlazorIntermediateLinkerOutputPath)&quot; @(_BlazorAssemblyDescriptorFiles, ' ') @(_BlazorAssembliesToLink, ' ')"  />

To Reproduce

Steps to reproduce the behavior: Probably: 1 Install .NET 2.1.600-preview-009426 2 Install Visual Studio 2019 3 Create dotnet new blazorhosted 4 Try to run the app.

  1. See error

Expected behavior

App starting properly

Additional

I reproduced this bug on 2 different PCs with Win7.

In both cases scenerio was literally the same.

Related: 1 month ago:

https://stackoverflow.com/questions/53622867/net-blazor-error-msb3073-when-building-app-but-and-how-to-fix-it-deleting-row

cshung commented 5 years ago

This issue does not reproduce anymore, please consider closing this.